summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-10-01 15:29:53 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-10-01 15:29:53 (GMT)
commitec8ad09125032c9c232878d02e90aa86df162841 (patch)
tree5d63105d3a0db7d5bbee41c5b74b097649a2115e /tools/src
parent453238e90e1574ef1c15e3c79f7fb3d77920e77c (diff)
downloadhdf5-ec8ad09125032c9c232878d02e90aa86df162841.zip
hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.gz
hdf5-ec8ad09125032c9c232878d02e90aa86df162841.tar.bz2
Source formatted
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5copy/h5copy.c338
-rw-r--r--tools/src/h5diff/h5diff_common.c802
-rw-r--r--tools/src/h5diff/h5diff_common.h5
-rw-r--r--tools/src/h5diff/h5diff_main.c54
-rw-r--r--tools/src/h5diff/ph5diff_main.c120
-rw-r--r--tools/src/h5dump/h5dump.c1365
-rw-r--r--tools/src/h5dump/h5dump.h102
-rw-r--r--tools/src/h5dump/h5dump_ddl.c1510
-rw-r--r--tools/src/h5dump/h5dump_ddl.h29
-rw-r--r--tools/src/h5dump/h5dump_defines.h57
-rw-r--r--tools/src/h5dump/h5dump_extern.h97
-rw-r--r--tools/src/h5dump/h5dump_xml.c3048
-rw-r--r--tools/src/h5dump/h5dump_xml.h18
-rw-r--r--tools/src/h5format_convert/h5format_convert.c259
-rw-r--r--tools/src/h5import/h5import.c4932
-rw-r--r--tools/src/h5import/h5import.h196
-rw-r--r--tools/src/h5jam/h5jam.c317
-rw-r--r--tools/src/h5jam/h5unjam.c201
-rw-r--r--tools/src/h5ls/h5ls.c1201
-rw-r--r--tools/src/h5repack/h5repack.c225
-rw-r--r--tools/src/h5repack/h5repack.h199
-rw-r--r--tools/src/h5repack/h5repack_copy.c1423
-rw-r--r--tools/src/h5repack/h5repack_filters.c311
-rw-r--r--tools/src/h5repack/h5repack_main.c354
-rw-r--r--tools/src/h5repack/h5repack_opttable.c106
-rw-r--r--tools/src/h5repack/h5repack_parse.c314
-rw-r--r--tools/src/h5repack/h5repack_refs.c544
-rw-r--r--tools/src/h5repack/h5repack_verify.c366
-rw-r--r--tools/src/h5stat/h5stat.c1107
-rw-r--r--tools/src/misc/h5clear.c196
-rw-r--r--tools/src/misc/h5debug.c473
-rw-r--r--tools/src/misc/h5mkgrp.c103
-rw-r--r--tools/src/misc/h5repart.c334
33 files changed, 10502 insertions, 10204 deletions
diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c
index a6e4d4e..4a076cb 100644
--- a/tools/src/h5copy/h5copy.c
+++ b/tools/src/h5copy/h5copy.c
@@ -19,25 +19,23 @@
#define PROGRAMNAME "h5copy"
/* command-line options: short and long-named parameters */
-static const char *s_opts = "d:f:hi:o:ps:vVE";
-static struct long_options l_opts[] = {
- { "destination", require_arg, 'd' },
- { "flag", require_arg, 'f' },
- { "help", no_arg, 'h' },
- { "input", require_arg, 'i' },
- { "output", require_arg, 'o' },
- { "parents", no_arg, 'p' },
- { "source", require_arg, 's' },
- { "verbose", no_arg, 'v' },
- { "version", no_arg, 'V' },
- { "enable-error-stack", no_arg, 'E' },
- { NULL, 0, '\0' }
-};
-char *fname_src = NULL;
-char *fname_dst = NULL;
-char *oname_src = NULL;
-char *oname_dst = NULL;
-char *str_flag = NULL;
+static const char * s_opts = "d:f:hi:o:ps:vVE";
+static struct long_options l_opts[] = {{"destination", require_arg, 'd'},
+ {"flag", require_arg, 'f'},
+ {"help", no_arg, 'h'},
+ {"input", require_arg, 'i'},
+ {"output", require_arg, 'o'},
+ {"parents", no_arg, 'p'},
+ {"source", require_arg, 's'},
+ {"verbose", no_arg, 'v'},
+ {"version", no_arg, 'V'},
+ {"enable-error-stack", no_arg, 'E'},
+ {NULL, 0, '\0'}};
+char * fname_src = NULL;
+char * fname_dst = NULL;
+char * oname_src = NULL;
+char * oname_dst = NULL;
+char * str_flag = NULL;
/*-------------------------------------------------------------------------
* Function: leave
@@ -71,7 +69,6 @@ leave(int ret)
HDexit(ret);
}
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -86,7 +83,7 @@ leave(int ret)
*-------------------------------------------------------------------------
*/
static void
-usage (void)
+usage(void)
{
FLUSHSTREAM(rawoutstream);
PRINTVALSTREAM(rawoutstream, "\n");
@@ -98,29 +95,41 @@ usage (void)
PRINTVALSTREAM(rawoutstream, " -d, --destination destination object name\n");
PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n");
- PRINTVALSTREAM(rawoutstream, " -p, --parents No error if existing, make parent groups as needed\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -p, --parents No error if existing, make parent groups as needed\n");
PRINTVALSTREAM(rawoutstream, " -v, --verbose Print information about OBJECTS and OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
- PRINTVALSTREAM(rawoutstream, " Prints messages from the HDF5 error stack as they occur.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Prints messages from the HDF5 error stack as they occur.\n");
PRINTVALSTREAM(rawoutstream, " -f, --flag Flag type\n\n");
PRINTVALSTREAM(rawoutstream, " Flag type is one of the following strings:\n\n");
PRINTVALSTREAM(rawoutstream, " shallow Copy only immediate members for groups\n\n");
PRINTVALSTREAM(rawoutstream, " soft Expand soft links into new objects\n\n");
PRINTVALSTREAM(rawoutstream, " ext Expand external links into new objects\n\n");
- PRINTVALSTREAM(rawoutstream, " ref Copy references and any referenced objects, i.e., objects\n");
+ PRINTVALSTREAM(rawoutstream,
+ " ref Copy references and any referenced objects, i.e., objects\n");
PRINTVALSTREAM(rawoutstream, " that the references point to.\n");
- PRINTVALSTREAM(rawoutstream, " Referenced objects are copied in addition to the objects\n");
- PRINTVALSTREAM(rawoutstream, " specified on the command line and reference datasets are\n");
- PRINTVALSTREAM(rawoutstream, " populated with correct reference values. Copies of referenced\n");
- PRINTVALSTREAM(rawoutstream, " datasets outside the copy range specified on the command line\n");
- PRINTVALSTREAM(rawoutstream, " will normally have a different name from the original.\n");
- PRINTVALSTREAM(rawoutstream, " (Default:Without this option, reference value(s) in any\n");
- PRINTVALSTREAM(rawoutstream, " reference datasets are set to NULL and referenced objects are\n");
- PRINTVALSTREAM(rawoutstream, " not copied unless they are otherwise within the copy range\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Referenced objects are copied in addition to the objects\n");
+ PRINTVALSTREAM(rawoutstream,
+ " specified on the command line and reference datasets are\n");
+ PRINTVALSTREAM(rawoutstream,
+ " populated with correct reference values. Copies of referenced\n");
+ PRINTVALSTREAM(rawoutstream,
+ " datasets outside the copy range specified on the command line\n");
+ PRINTVALSTREAM(rawoutstream,
+ " will normally have a different name from the original.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " (Default:Without this option, reference value(s) in any\n");
+ PRINTVALSTREAM(rawoutstream,
+ " reference datasets are set to NULL and referenced objects are\n");
+ PRINTVALSTREAM(rawoutstream,
+ " not copied unless they are otherwise within the copy range\n");
PRINTVALSTREAM(rawoutstream, " specified on the command line.)\n\n");
PRINTVALSTREAM(rawoutstream, " noattr Copy object without copying attributes\n\n");
- PRINTVALSTREAM(rawoutstream, " allflags Switches all flags from the default to the non-default setting\n\n");
+ PRINTVALSTREAM(rawoutstream,
+ " allflags Switches all flags from the default to the non-default setting\n\n");
PRINTVALSTREAM(rawoutstream, " These flag types correspond to the following API symbols\n\n");
PRINTVALSTREAM(rawoutstream, " H5O_COPY_SHALLOW_HIERARCHY_FLAG\n");
PRINTVALSTREAM(rawoutstream, " H5O_COPY_EXPAND_SOFT_LINK_FLAG\n");
@@ -130,8 +139,6 @@ usage (void)
PRINTVALSTREAM(rawoutstream, " H5O_COPY_ALL\n");
}
-
-
/*-------------------------------------------------------------------------
* Function: parse_flag
*
@@ -156,30 +163,30 @@ usage (void)
*-------------------------------------------------------------------------
*/
-
-static int parse_flag(const char* s_flag, unsigned *flag)
+static int
+parse_flag(const char *s_flag, unsigned *flag)
{
- unsigned fla=0;
+ unsigned fla = 0;
if (HDstrcmp(s_flag, "shallow") == 0) {
fla = H5O_COPY_SHALLOW_HIERARCHY_FLAG;
}
- else if (HDstrcmp(s_flag, "soft") == 0) {
+ else if (HDstrcmp(s_flag, "soft") == 0) {
fla = H5O_COPY_EXPAND_SOFT_LINK_FLAG;
}
- else if (HDstrcmp(s_flag, "ext") == 0) {
+ else if (HDstrcmp(s_flag, "ext") == 0) {
fla = H5O_COPY_EXPAND_EXT_LINK_FLAG;
}
- else if (HDstrcmp(s_flag, "ref") == 0) {
+ else if (HDstrcmp(s_flag, "ref") == 0) {
fla = H5O_COPY_EXPAND_REFERENCE_FLAG;
}
- else if (HDstrcmp(s_flag, "noattr") == 0) {
+ else if (HDstrcmp(s_flag, "noattr") == 0) {
fla = H5O_COPY_WITHOUT_ATTR_FLAG;
}
- else if (HDstrcmp(s_flag, "allflags") == 0) {
+ else if (HDstrcmp(s_flag, "allflags") == 0) {
fla = H5O_COPY_ALL;
}
- else if (HDstrcmp(s_flag, "nullmsg") == 0) {
+ else if (HDstrcmp(s_flag, "nullmsg") == 0) {
fla = H5O_COPY_PRESERVE_NULL_FLAG;
}
else {
@@ -205,19 +212,19 @@ static int parse_flag(const char* s_flag, unsigned *flag)
*/
int
-main (int argc, const char *argv[])
+main(int argc, const char *argv[])
{
- hid_t fid_src = H5I_INVALID_HID;
- hid_t fid_dst = H5I_INVALID_HID;
- unsigned flag = 0;
- unsigned verbose = 0;
- unsigned parents = 0;
- hid_t ocpl_id = H5I_INVALID_HID; /* Object copy property list */
- hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list */
- int opt;
- int li_ret;
+ hid_t fid_src = H5I_INVALID_HID;
+ hid_t fid_dst = H5I_INVALID_HID;
+ unsigned flag = 0;
+ unsigned verbose = 0;
+ unsigned parents = 0;
+ hid_t ocpl_id = H5I_INVALID_HID; /* Object copy property list */
+ hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list */
+ int opt;
+ int li_ret;
h5tool_link_info_t linkinfo;
- int ret_value = 0;
+ int ret_value = 0;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -229,7 +236,7 @@ main (int argc, const char *argv[])
HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t));
/* Check for no command line parameters */
- if(argc == 1) {
+ if (argc == 1) {
usage();
leave(EXIT_FAILURE);
} /* end if */
@@ -237,82 +244,82 @@ main (int argc, const char *argv[])
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
- case 'd':
- oname_dst = HDstrdup(opt_arg);
- break;
+ case 'd':
+ oname_dst = HDstrdup(opt_arg);
+ break;
+
+ case 'f':
+ /* validate flag */
+ if (parse_flag(opt_arg, &flag) < 0) {
+ usage();
+ leave(EXIT_FAILURE);
+ }
+ str_flag = HDstrdup(opt_arg);
+ break;
+
+ case 'h':
+ usage();
+ leave(EXIT_SUCCESS);
+ break;
+
+ case 'i':
+ fname_src = HDstrdup(opt_arg);
+ break;
+
+ case 'o':
+ fname_dst = HDstrdup(opt_arg);
+ break;
+
+ case 'p':
+ parents = 1;
+ break;
- case 'f':
- /* validate flag */
- if (parse_flag(opt_arg, &flag) < 0) {
+ case 's':
+ oname_src = HDstrdup(opt_arg);
+ break;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ verbose = 1;
+ break;
+
+ case 'E':
+ enable_error_stack = 1;
+ break;
+
+ default:
usage();
leave(EXIT_FAILURE);
- }
- str_flag = HDstrdup(opt_arg);
- break;
-
- case 'h':
- usage();
- leave(EXIT_SUCCESS);
- break;
-
- case 'i':
- fname_src = HDstrdup(opt_arg);
- break;
-
- case 'o':
- fname_dst = HDstrdup(opt_arg);
- break;
-
- case 'p':
- parents = 1;
- break;
-
- case 's':
- oname_src = HDstrdup(opt_arg);
- break;
-
- case 'V':
- print_version(h5tools_getprogname());
- leave(EXIT_SUCCESS);
- break;
-
- case 'v':
- verbose = 1;
- break;
-
- case 'E':
- enable_error_stack = 1;
- break;
-
- default:
- usage();
- leave(EXIT_FAILURE);
}
} /* end of while */
-/*-------------------------------------------------------------------------
- * check for missing file/object names
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * check for missing file/object names
+ *-------------------------------------------------------------------------*/
- if (fname_src==NULL) {
+ if (fname_src == NULL) {
error_msg("Input file name missing\n");
usage();
leave(EXIT_FAILURE);
}
- if (fname_dst==NULL) {
+ if (fname_dst == NULL) {
error_msg("Output file name missing\n");
usage();
leave(EXIT_FAILURE);
}
- if (oname_src==NULL) {
+ if (oname_src == NULL) {
error_msg("Source object name missing\n");
usage();
leave(EXIT_FAILURE);
}
- if (oname_dst==NULL) {
+ if (oname_dst == NULL) {
error_msg("Destination object name missing\n");
usage();
leave(EXIT_FAILURE);
@@ -321,63 +328,61 @@ main (int argc, const char *argv[])
/* enable error reporting if command line option */
h5tools_error_report();
- /*-------------------------------------------------------------------------
- * open output file
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * open output file
+ *-------------------------------------------------------------------------*/
/* Attempt to open an existing HDF5 file first. Need to open the dst file
before the src file just in case that the dst and src are the same file
*/
fid_dst = h5tools_fopen(fname_dst, H5F_ACC_RDWR, H5P_DEFAULT, FALSE, NULL, 0);
- /*-------------------------------------------------------------------------
- * open input file
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * open input file
+ *-------------------------------------------------------------------------*/
fid_src = h5tools_fopen(fname_src, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, 0);
- /*-------------------------------------------------------------------------
- * test for error in opening input file
- *-------------------------------------------------------------------------*/
- if (fid_src==-1) {
+ /*-------------------------------------------------------------------------
+ * test for error in opening input file
+ *-------------------------------------------------------------------------*/
+ if (fid_src == -1) {
error_msg("Could not open input file <%s>...Exiting\n", fname_src);
leave(EXIT_FAILURE);
}
-
- /*-------------------------------------------------------------------------
- * create an output file when failed to open it
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * create an output file when failed to open it
+ *-------------------------------------------------------------------------*/
/* If we couldn't open an existing file, try creating file */
/* (use "EXCL" instead of "TRUNC", so we don't blow away existing non-HDF5 file) */
- if(fid_dst < 0)
+ if (fid_dst < 0)
fid_dst = H5Fcreate(fname_dst, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
- /*-------------------------------------------------------------------------
- * test for error in opening output file
- *-------------------------------------------------------------------------*/
- if (fid_dst==-1) {
+ /*-------------------------------------------------------------------------
+ * test for error in opening output file
+ *-------------------------------------------------------------------------*/
+ if (fid_dst == -1) {
error_msg("Could not open output file <%s>...Exiting\n", fname_dst);
leave(EXIT_FAILURE);
}
- /*-------------------------------------------------------------------------
- * print some info
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * print some info
+ *-------------------------------------------------------------------------*/
if (verbose) {
- HDprintf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n",
- fname_src, oname_src, fname_dst, oname_dst);
+ HDprintf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n", fname_src, oname_src,
+ fname_dst, oname_dst);
if (flag) {
HDprintf("Using %s flag\n", str_flag);
}
}
-
- /*-------------------------------------------------------------------------
- * create property lists for copy
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * create property lists for copy
+ *-------------------------------------------------------------------------*/
/* create property to pass copy options */
if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
@@ -385,42 +390,42 @@ main (int argc, const char *argv[])
/* set options for object copy */
if (flag) {
- if ( H5Pset_copy_object(ocpl_id, flag) < 0)
+ if (H5Pset_copy_object(ocpl_id, flag) < 0)
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pset_copy_object failed");
}
/* Create link creation property list */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
error_msg("Could not create link creation property list\n");
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pcreate failed");
} /* end if */
/* Check for creating intermediate groups */
- if(parents) {
+ if (parents) {
/* Set the intermediate group creation property */
- if(H5Pset_create_intermediate_group(lcpl_id, 1) < 0) {
+ if (H5Pset_create_intermediate_group(lcpl_id, 1) < 0) {
error_msg("Could not set property for creating parent groups\n");
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pset_create_intermediate_group failed");
} /* end if */
/* Display some output if requested */
- if(verbose)
+ if (verbose)
HDprintf("%s: Creating parent groups\n", h5tools_getprogname());
} /* end if */
else {
/* error, if parent groups doesn't already exist in destination file */
- size_t i, len;
+ size_t i, len;
len = HDstrlen(oname_dst);
/* check if all the parents groups exist. skip root group */
for (i = 1; i < len; i++) {
- if ('/'==oname_dst[i]) {
- char *str_ptr;
+ if ('/' == oname_dst[i]) {
+ char *str_ptr;
str_ptr = (char *)HDcalloc(i + 1, sizeof(char));
HDstrncpy(str_ptr, oname_dst, i);
- str_ptr[i]='\0';
+ str_ptr[i] = '\0';
if (H5Lexists(fid_dst, str_ptr, H5P_DEFAULT) <= 0) {
error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n", str_ptr);
HDfree(str_ptr);
@@ -431,29 +436,27 @@ main (int argc, const char *argv[])
}
}
- /*-------------------------------------------------------------------------
- * do the copy
- *-------------------------------------------------------------------------*/
+ /*-------------------------------------------------------------------------
+ * do the copy
+ *-------------------------------------------------------------------------*/
- if(verbose)
+ if (verbose)
linkinfo.opt.msg_mode = 1;
li_ret = H5tools_get_symlink_info(fid_src, oname_src, &linkinfo, 1);
if (li_ret == 0) {
/* dangling link */
- if(H5Lcopy(fid_src, oname_src,
- fid_dst, oname_dst,
- H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcopy(fid_src, oname_src, fid_dst, oname_dst, H5P_DEFAULT, H5P_DEFAULT) < 0)
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Lcopy failed");
}
else {
/* valid link */
- if (H5Ocopy(fid_src, /* Source file or group identifier */
- oname_src, /* Name of the source object to be copied */
- fid_dst, /* Destination file or group identifier */
- oname_dst, /* Name of the destination object */
- ocpl_id, /* Object copy property list */
- lcpl_id)<0) /* Link creation property list */
+ if (H5Ocopy(fid_src, /* Source file or group identifier */
+ oname_src, /* Name of the source object to be copied */
+ fid_dst, /* Destination file or group identifier */
+ oname_dst, /* Name of the destination object */
+ ocpl_id, /* Object copy property list */
+ lcpl_id) < 0) /* Link creation property list */
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Ocopy failed");
}
@@ -462,15 +465,15 @@ main (int argc, const char *argv[])
HDfree(linkinfo.trg_path);
/* close propertis */
- if(H5Pclose(ocpl_id)<0)
+ if (H5Pclose(ocpl_id) < 0)
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pclose failed");
- if(H5Pclose(lcpl_id)<0)
+ if (H5Pclose(lcpl_id) < 0)
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pclose failed");
/* close files */
- if (H5Fclose(fid_src)<0)
+ if (H5Fclose(fid_src) < 0)
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Fclose failed");
- if (H5Fclose(fid_dst)<0)
+ if (H5Fclose(fid_dst) < 0)
H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Fclose failed");
leave(EXIT_SUCCESS);
@@ -482,13 +485,14 @@ done:
if (linkinfo.trg_path)
HDfree(linkinfo.trg_path);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(ocpl_id);
H5Pclose(lcpl_id);
H5Fclose(fid_src);
H5Fclose(fid_dst);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
leave(ret_value);
}
-
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index cfaf7f6..49ba14c 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -17,34 +17,32 @@
#include "h5tools.h"
#include "h5tools_utils.h"
-static int check_n_input(const char*);
-static int check_p_input(const char*);
-static int check_d_input(const char*);
+static int check_n_input(const char *);
+static int check_p_input(const char *);
+static int check_d_input(const char *);
/*
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVrv:qn:d:p:NcelxE:A:S";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "version", no_arg, 'V' },
- { "report", no_arg, 'r' },
- { "verbose", optional_arg, 'v' },
- { "quiet", no_arg, 'q' },
- { "count", require_arg, 'n' },
- { "delta", require_arg, 'd' },
- { "relative", require_arg, 'p' },
- { "nan", no_arg, 'N' },
- { "compare", no_arg, 'c' },
- { "use-system-epsilon", no_arg, 'e' },
- { "follow-symlinks", no_arg, 'l' },
- { "no-dangling-links", no_arg, 'x' },
- { "exclude-path", require_arg, 'E' },
- { "exclude-attribute", require_arg, 'A' },
- { "enable-error-stack", no_arg, 'S' },
- { NULL, 0, '\0' }
-};
+static const char * s_opts = "hVrv:qn:d:p:NcelxE:A:S";
+static struct long_options l_opts[] = {{"help", no_arg, 'h'},
+ {"version", no_arg, 'V'},
+ {"report", no_arg, 'r'},
+ {"verbose", optional_arg, 'v'},
+ {"quiet", no_arg, 'q'},
+ {"count", require_arg, 'n'},
+ {"delta", require_arg, 'd'},
+ {"relative", require_arg, 'p'},
+ {"nan", no_arg, 'N'},
+ {"compare", no_arg, 'c'},
+ {"use-system-epsilon", no_arg, 'e'},
+ {"follow-symlinks", no_arg, 'l'},
+ {"no-dangling-links", no_arg, 'x'},
+ {"exclude-path", require_arg, 'E'},
+ {"exclude-attribute", require_arg, 'A'},
+ {"enable-error-stack", no_arg, 'S'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: check_options
@@ -52,7 +50,8 @@ static struct long_options l_opts[] = {
* Purpose: parse command line input
*-------------------------------------------------------------------------
*/
-static void check_options(diff_opt_t* opts)
+static void
+check_options(diff_opt_t *opts)
{
/*--------------------------------------------------------------
* check for mutually exclusive options
@@ -64,7 +63,9 @@ static void check_options(diff_opt_t* opts)
if ((opts->delta_bool + opts->percent_bool + opts->use_system_epsilon) > 1) {
HDprintf("%s error: -d, -p and --use-system-epsilon options are mutually-exclusive;\n", PROGRAMNAME);
HDprintf("use no more than one.\n");
- HDprintf("Try '-h' or '--help' option for more information or see the %s entry in the 'HDF5 Reference Manual'.\n", PROGRAMNAME);
+ HDprintf("Try '-h' or '--help' option for more information or see the %s entry in the 'HDF5 "
+ "Reference Manual'.\n",
+ PROGRAMNAME);
h5diff_exit(EXIT_FAILURE);
}
}
@@ -88,11 +89,11 @@ static void check_options(diff_opt_t* opts)
static void
parse_hsize_list(const char *h_list, subset_d *d)
{
- hsize_t *p_list;
- const char *ptr;
- unsigned int size_count = 0;
- unsigned int i = 0;
- unsigned int last_digit = 0;
+ hsize_t * p_list;
+ const char * ptr;
+ unsigned int size_count = 0;
+ unsigned int i = 0;
+ unsigned int last_digit = 0;
if (!h_list || !*h_list || *h_list == ';')
return;
@@ -118,11 +119,11 @@ parse_hsize_list(const char *h_list, subset_d *d)
H5TOOLS_DEBUG("Number integers to read=%ld", size_count);
/* allocate an array for the integers in the list */
- if((p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t))) == NULL)
+ if ((p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t))) == NULL)
H5TOOLS_INFO("Unable to allocate space for subset data");
for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
- if(HDisdigit(*ptr)) {
+ if (HDisdigit(*ptr)) {
/* we should have an integer now */
p_list[i++] = (hsize_t)HDstrtoull(ptr, NULL, 0);
@@ -131,7 +132,7 @@ parse_hsize_list(const char *h_list, subset_d *d)
ptr++;
}
d->data = p_list;
- d->len = size_count;
+ d->len = size_count;
H5TOOLS_ENDDEBUG("");
}
@@ -148,7 +149,7 @@ static struct subset_t *
parse_subset_params(const char *dset)
{
struct subset_t *s = NULL;
- char *brace;
+ char * brace;
H5TOOLS_START_DEBUG(" - dset:%s", dset);
if ((brace = HDstrrchr(dset, '[')) != NULL) {
@@ -194,16 +195,18 @@ parse_subset_params(const char *dset)
*-------------------------------------------------------------------------
*/
-void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* opts)
+void
+parse_command_line(int argc, const char *argv[], const char **fname1, const char **fname2,
+ const char **objname1, const char **objname2, diff_opt_t *opts)
{
- int i;
- int opt;
+ int i;
+ int opt;
struct exclude_path_list *exclude_head, *exclude_prev, *exclude_node;
struct exclude_path_list *exclude_attr_head, *exclude_attr_prev, *exclude_attr_node;
H5TOOLS_START_DEBUG("");
/* process the command-line */
- HDmemset(opts, 0, sizeof (diff_opt_t));
+ HDmemset(opts, 0, sizeof(diff_opt_t));
/* assume equal contents initially */
opts->contents = 1;
@@ -227,176 +230,178 @@ void parse_command_line(int argc, const char* argv[], const char** fname1, const
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
- default:
- usage();
- h5diff_exit(EXIT_FAILURE);
- break;
-
- case 'h':
- usage();
- h5diff_exit(EXIT_SUCCESS);
- break;
-
- case 'V':
- print_version(h5tools_getprogname());
- h5diff_exit(EXIT_SUCCESS);
- break;
-
- case 'v':
- opts->mode_verbose = 1;
- /* This for loop is for handling style like
- * -v, -v1, --verbose, --verbose=1.
- */
- for (i = 1; i < argc; i++) {
- /*
- * short opt
+ default:
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ break;
+
+ case 'h':
+ usage();
+ h5diff_exit(EXIT_SUCCESS);
+ break;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ h5diff_exit(EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ opts->mode_verbose = 1;
+ /* This for loop is for handling style like
+ * -v, -v1, --verbose, --verbose=1.
*/
- if (!strcmp (argv[i], "-v")) { /* no arg */
- opt_ind--;
- opts->mode_verbose_level = 0;
- break;
+ for (i = 1; i < argc; i++) {
+ /*
+ * short opt
+ */
+ if (!strcmp(argv[i], "-v")) { /* no arg */
+ opt_ind--;
+ opts->mode_verbose_level = 0;
+ break;
+ }
+ else if (!strncmp(argv[i], "-v", (size_t)2)) {
+ opts->mode_verbose_level = atoi(&argv[i][2]);
+ break;
+ }
+
+ /*
+ * long opt
+ */
+ if (!strcmp(argv[i], "--verbose")) { /* no arg */
+ opts->mode_verbose_level = 0;
+ break;
+ }
+ else if (!strncmp(argv[i], "--verbose", (size_t)9) && argv[i][9] == '=') {
+ opts->mode_verbose_level = atoi(&argv[i][10]);
+ break;
+ }
}
- else if (!strncmp (argv[i], "-v", (size_t)2)) {
- opts->mode_verbose_level = atoi(&argv[i][2]);
- break;
+ break;
+
+ case 'q':
+ /* use quiet mode; supress the message "0 differences found" */
+ opts->mode_quiet = 1;
+ break;
+
+ case 'r':
+ opts->mode_report = 1;
+ break;
+
+ case 'l':
+ opts->follow_links = TRUE;
+ break;
+
+ case 'x':
+ opts->no_dangle_links = 1;
+ break;
+
+ case 'S':
+ enable_error_stack = 1;
+ break;
+
+ case 'E':
+ opts->exclude_path = 1;
+
+ /* create linked list of excluding objects */
+ if ((exclude_node = (struct exclude_path_list *)HDmalloc(sizeof(struct exclude_path_list))) ==
+ NULL) {
+ HDprintf("Error: lack of memory!\n");
+ h5diff_exit(EXIT_FAILURE);
}
- /*
- * long opt
- */
- if (!strcmp (argv[i], "--verbose")) { /* no arg */
- opts->mode_verbose_level = 0;
- break;
+ /* init */
+ exclude_node->obj_path = opt_arg;
+ exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN;
+ exclude_prev = exclude_head;
+
+ if (NULL == exclude_head) {
+ exclude_head = exclude_node;
+ exclude_head->next = NULL;
}
- else if (!strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=') {
- opts->mode_verbose_level = atoi(&argv[i][10]);
- break;
+ else {
+ while (NULL != exclude_prev->next)
+ exclude_prev = exclude_prev->next;
+
+ exclude_node->next = NULL;
+ exclude_prev->next = exclude_node;
}
- }
- break;
+ break;
- case 'q':
- /* use quiet mode; supress the message "0 differences found" */
- opts->mode_quiet = 1;
- break;
+ case 'A':
+ opts->exclude_attr_path = 1;
- case 'r':
- opts->mode_report = 1;
- break;
+ /* create linked list of excluding objects */
+ if ((exclude_attr_node =
+ (struct exclude_path_list *)HDmalloc(sizeof(struct exclude_path_list))) == NULL) {
+ HDprintf("Error: lack of memory!\n");
+ h5diff_exit(EXIT_FAILURE);
+ }
- case 'l':
- opts->follow_links = TRUE;
- break;
+ /* init */
+ exclude_attr_node->obj_path = opt_arg;
+ exclude_attr_node->obj_type = H5TRAV_TYPE_UNKNOWN;
+ exclude_attr_prev = exclude_attr_head;
- case 'x':
- opts->no_dangle_links = 1;
- break;
+ if (NULL == exclude_attr_head) {
+ exclude_attr_head = exclude_attr_node;
+ exclude_attr_head->next = NULL;
+ }
+ else {
+ while (NULL != exclude_attr_prev->next)
+ exclude_attr_prev = exclude_attr_prev->next;
- case 'S':
- enable_error_stack = 1;
- break;
+ exclude_attr_node->next = NULL;
+ exclude_attr_prev->next = exclude_attr_node;
+ }
+ break;
- case 'E':
- opts->exclude_path = 1;
+ case 'd':
+ opts->delta_bool = 1;
- /* create linked list of excluding objects */
- if( (exclude_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL) {
- HDprintf("Error: lack of memory!\n");
- h5diff_exit(EXIT_FAILURE);
- }
-
- /* init */
- exclude_node->obj_path = opt_arg;
- exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN;
- exclude_prev = exclude_head;
-
- if (NULL == exclude_head) {
- exclude_head = exclude_node;
- exclude_head->next = NULL;
- }
- else {
- while(NULL != exclude_prev->next)
- exclude_prev = exclude_prev->next;
-
- exclude_node->next = NULL;
- exclude_prev->next = exclude_node;
- }
- break;
-
- case 'A':
- opts->exclude_attr_path = 1;
-
- /* create linked list of excluding objects */
- if( (exclude_attr_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL) {
- HDprintf("Error: lack of memory!\n");
- h5diff_exit(EXIT_FAILURE);
- }
-
- /* init */
- exclude_attr_node->obj_path = opt_arg;
- exclude_attr_node->obj_type = H5TRAV_TYPE_UNKNOWN;
- exclude_attr_prev = exclude_attr_head;
-
- if (NULL == exclude_attr_head) {
- exclude_attr_head = exclude_attr_node;
- exclude_attr_head->next = NULL;
- }
- else {
- while(NULL != exclude_attr_prev->next)
- exclude_attr_prev = exclude_attr_prev->next;
-
- exclude_attr_node->next = NULL;
- exclude_attr_prev->next = exclude_attr_node;
- }
- break;
-
- case 'd':
- opts->delta_bool = 1;
-
- if (check_d_input(opt_arg) == -1) {
- HDprintf("<-d %s> is not a valid option\n", opt_arg);
- usage();
- h5diff_exit(EXIT_FAILURE);
- }
- opts->delta = HDatof(opt_arg);
- /* do not check against default, the DBL_EPSILON is being replaced by user */
- break;
-
- case 'p':
- opts->percent_bool = 1;
- if (check_p_input(opt_arg) == -1) {
- HDprintf("<-p %s> is not a valid option\n", opt_arg);
- usage();
- h5diff_exit(EXIT_FAILURE);
- }
- opts->percent = HDatof(opt_arg);
-
- /* -p 0 is the same as default */
- if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F))
- opts->percent_bool = 0;
- break;
-
- case 'n':
- opts->count_bool = 1;
- if (check_n_input(opt_arg) == -1) {
- HDprintf("<-n %s> is not a valid option\n", opt_arg);
- usage();
- h5diff_exit(EXIT_FAILURE);
- }
- opts->count = HDstrtoull(opt_arg, NULL, 0);
- break;
+ if (check_d_input(opt_arg) == -1) {
+ HDprintf("<-d %s> is not a valid option\n", opt_arg);
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
+ opts->delta = HDatof(opt_arg);
+ /* do not check against default, the DBL_EPSILON is being replaced by user */
+ break;
+
+ case 'p':
+ opts->percent_bool = 1;
+ if (check_p_input(opt_arg) == -1) {
+ HDprintf("<-p %s> is not a valid option\n", opt_arg);
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
+ opts->percent = HDatof(opt_arg);
+
+ /* -p 0 is the same as default */
+ if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F))
+ opts->percent_bool = 0;
+ break;
+
+ case 'n':
+ opts->count_bool = 1;
+ if (check_n_input(opt_arg) == -1) {
+ HDprintf("<-n %s> is not a valid option\n", opt_arg);
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
+ opts->count = HDstrtoull(opt_arg, NULL, 0);
+ break;
- case 'N':
- opts->do_nans = 0;
- break;
+ case 'N':
+ opts->do_nans = 0;
+ break;
- case 'c':
- opts->mode_list_not_cmp = 1;
- break;
+ case 'c':
+ opts->mode_list_not_cmp = 1;
+ break;
- case 'e':
- opts->use_system_epsilon = 1;
- break;
+ case 'e':
+ opts->use_system_epsilon = 1;
+ break;
}
}
@@ -418,8 +423,8 @@ void parse_command_line(int argc, const char* argv[], const char** fname1, const
h5diff_exit(EXIT_FAILURE);
}
- *fname1 = argv[opt_ind];
- *fname2 = argv[opt_ind + 1];
+ *fname1 = argv[opt_ind];
+ *fname2 = argv[opt_ind + 1];
*objname1 = argv[opt_ind + 2];
H5TOOLS_DEBUG("file1 = %s", *fname1);
H5TOOLS_DEBUG("file2 = %s", *fname2);
@@ -442,7 +447,7 @@ void parse_command_line(int argc, const char* argv[], const char** fname1, const
/*
* TRILABS_227 is complete except for an issue with printing indices
* the following calls will enable subsetting
- */
+ */
#if TRILABS_227
opts->sset[0] = parse_subset_params(*objname1);
@@ -452,14 +457,14 @@ void parse_command_line(int argc, const char* argv[], const char** fname1, const
H5TOOLS_ENDDEBUG("");
}
-
/*-------------------------------------------------------------------------
* Function: print_info
*
* Purpose: print several information messages after h5diff call
*-------------------------------------------------------------------------
*/
-void print_info(diff_opt_t* opts)
+void
+print_info(diff_opt_t *opts)
{
if (opts->mode_quiet || opts->err_stat)
return;
@@ -495,7 +500,7 @@ H5_ATTR_PURE static int
check_n_input(const char *str)
{
unsigned i;
- char c;
+ char c;
for (i = 0; i < HDstrlen(str); i++) {
c = str[i];
@@ -503,9 +508,8 @@ check_n_input(const char *str)
if (c < 49 || c > 57) /* ascii values between 1 and 9 */
return -1;
}
- else
- if (c < 48 || c > 57) /* 0 also */
- return -1;
+ else if (c < 48 || c > 57) /* 0 also */
+ return -1;
}
return 1;
}
@@ -573,176 +577,230 @@ check_d_input(const char *str)
*-------------------------------------------------------------------------
*/
-void usage(void)
+void
+usage(void)
{
- PRINTVALSTREAM(rawoutstream, "usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]\n");
- PRINTVALSTREAM(rawoutstream, " file1 File name of the first HDF5 file\n");
- PRINTVALSTREAM(rawoutstream, " file2 File name of the second HDF5 file\n");
- PRINTVALSTREAM(rawoutstream, " [obj1] Name of an HDF5 object, in absolute path\n");
- PRINTVALSTREAM(rawoutstream, " [obj2] Name of an HDF5 object, in absolute path\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
- PRINTVALSTREAM(rawoutstream, " -h, --help\n");
- PRINTVALSTREAM(rawoutstream, " Print a usage message and exit.\n");
- PRINTVALSTREAM(rawoutstream, " -V, --version\n");
- PRINTVALSTREAM(rawoutstream, " Print version number and exit.\n");
- PRINTVALSTREAM(rawoutstream, " -r, --report\n");
- PRINTVALSTREAM(rawoutstream, " Report mode. Print differences.\n");
- PRINTVALSTREAM(rawoutstream, " -v --verbose\n");
- PRINTVALSTREAM(rawoutstream, " Verbose mode. Print differences information and list of objects.\n");
- PRINTVALSTREAM(rawoutstream, " -vN --verbose=N\n");
- PRINTVALSTREAM(rawoutstream, " Verbose mode with level. Print differences and list of objects.\n");
- PRINTVALSTREAM(rawoutstream, " Level of detail depends on value of N:\n");
- PRINTVALSTREAM(rawoutstream, " 0 : Identical to '-v' or '--verbose'.\n");
- PRINTVALSTREAM(rawoutstream, " 1 : All level 0 information plus one-line attribute status summary.\n");
- PRINTVALSTREAM(rawoutstream, " 2 : All level 1 information plus extended attribute status report.\n");
- PRINTVALSTREAM(rawoutstream, " 3 : All level 2 information plus file names.\n");
- PRINTVALSTREAM(rawoutstream, " -q, --quiet\n");
- PRINTVALSTREAM(rawoutstream, " Quiet mode. Do not produce output.\n");
- PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
- PRINTVALSTREAM(rawoutstream, " Prints messages from the HDF5 error stack as they occur.\n");
- PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n");
- PRINTVALSTREAM(rawoutstream, " Follow symbolic links (soft links and external links and compare the)\n");
- PRINTVALSTREAM(rawoutstream, " links' target objects.\n");
- PRINTVALSTREAM(rawoutstream, " If symbolic link(s) with the same name exist in the files being\n");
- PRINTVALSTREAM(rawoutstream, " compared, then determine whether the target of each link is an existing\n");
- PRINTVALSTREAM(rawoutstream, " object (dataset, group, or named datatype) or the link is a dangling\n");
- PRINTVALSTREAM(rawoutstream, " link (a soft or external link pointing to a target object that does\n");
- PRINTVALSTREAM(rawoutstream, " not yet exist).\n");
- PRINTVALSTREAM(rawoutstream, " - If both symbolic links are dangling links, they are treated as being\n");
- PRINTVALSTREAM(rawoutstream, " the same; by default, h5diff returns an exit code of 0.\n");
- PRINTVALSTREAM(rawoutstream, " If, however, --no-dangling-links is used with --follow-symlinks,\n");
- PRINTVALSTREAM(rawoutstream, " this situation is treated as an error and h5diff returns an\n");
- PRINTVALSTREAM(rawoutstream, " exit code of 2.\n");
- PRINTVALSTREAM(rawoutstream, " - If only one of the two links is a dangling link,they are treated as\n");
- PRINTVALSTREAM(rawoutstream, " being different and h5diff returns an exit code of 1.\n");
- PRINTVALSTREAM(rawoutstream, " If, however, --no-dangling-links is used with --follow-symlinks,\n");
- PRINTVALSTREAM(rawoutstream, " this situation is treated as an error and h5diff returns an\n");
- PRINTVALSTREAM(rawoutstream, " exit code of 2.\n");
- PRINTVALSTREAM(rawoutstream, " - If both symbolic links point to existing objects, h5diff compares the\n");
- PRINTVALSTREAM(rawoutstream, " two objects.\n");
- PRINTVALSTREAM(rawoutstream, " If any symbolic link specified in the call to h5diff does not exist,\n");
- PRINTVALSTREAM(rawoutstream, " h5diff treats it as an error and returns an exit code of 2.\n");
- PRINTVALSTREAM(rawoutstream, " --no-dangling-links\n");
- PRINTVALSTREAM(rawoutstream, " Must be used with --follow-symlinks option; otherwise, h5diff shows\n");
- PRINTVALSTREAM(rawoutstream, " error message and returns an exit code of 2.\n");
- PRINTVALSTREAM(rawoutstream, " Check for any symbolic links (soft links or external links) that do not\n");
- PRINTVALSTREAM(rawoutstream, " resolve to an existing object (dataset, group, or named datatype).\n");
- PRINTVALSTREAM(rawoutstream, " If any dangling link is found, this situation is treated as an error\n");
- PRINTVALSTREAM(rawoutstream, " and h5diff returns an exit code of 2.\n");
- PRINTVALSTREAM(rawoutstream, " -c, --compare\n");
- PRINTVALSTREAM(rawoutstream, " List objects that are not comparable\n");
- PRINTVALSTREAM(rawoutstream, " -N, --nan\n");
- PRINTVALSTREAM(rawoutstream, " Avoid NaNs detection\n");
- PRINTVALSTREAM(rawoutstream, " -n C, --count=C\n");
- PRINTVALSTREAM(rawoutstream, " Print differences up to C. C must be a positive integer.\n");
- PRINTVALSTREAM(rawoutstream, " -d D, --delta=D\n");
- PRINTVALSTREAM(rawoutstream, " Print difference if (|a-b| > D). D must be a positive number. Where a\n");
- PRINTVALSTREAM(rawoutstream, " is the data point value in file1 and b is the data point value in file2.\n");
- PRINTVALSTREAM(rawoutstream, " Can not use with '-p' or '--use-system-epsilon'.\n");
- PRINTVALSTREAM(rawoutstream, " -p R, --relative=R\n");
- PRINTVALSTREAM(rawoutstream, " Print difference if (|(a-b)/b| > R). R must be a positive number. Where a\n");
- PRINTVALSTREAM(rawoutstream, " is the data point value in file1 and b is the data point value in file2.\n");
- PRINTVALSTREAM(rawoutstream, " Can not use with '-d' or '--use-system-epsilon'.\n");
- PRINTVALSTREAM(rawoutstream, " --use-system-epsilon\n");
- PRINTVALSTREAM(rawoutstream, " Print difference if (|a-b| > EPSILON), EPSILON is system defined value. Where a\n");
- PRINTVALSTREAM(rawoutstream, " is the data point value in file1 and b is the data point value in file2.\n");
- PRINTVALSTREAM(rawoutstream, " If the system epsilon is not defined,one of the following predefined\n");
- PRINTVALSTREAM(rawoutstream, " values will be used:\n");
- PRINTVALSTREAM(rawoutstream, " FLT_EPSILON = 1.19209E-07 for floating-point type\n");
- PRINTVALSTREAM(rawoutstream, " DBL_EPSILON = 2.22045E-16 for double precision type\n");
- PRINTVALSTREAM(rawoutstream, " Can not use with '-p' or '-d'.\n");
- PRINTVALSTREAM(rawoutstream, " --exclude-path \"path\"\n");
- PRINTVALSTREAM(rawoutstream, " Exclude the specified path to an object when comparing files or groups.\n");
- PRINTVALSTREAM(rawoutstream, " If a group is excluded, all member objects will also be excluded.\n");
- PRINTVALSTREAM(rawoutstream, " The specified path is excluded wherever it occurs.\n");
- PRINTVALSTREAM(rawoutstream, " This flexibility enables the same option to exclude either objects that\n");
- PRINTVALSTREAM(rawoutstream, " exist only in one file or common objects that are known to differ.\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " When comparing files, \"path\" is the absolute path to the excluded;\n");
- PRINTVALSTREAM(rawoutstream, " object; when comparing groups, \"path\" is similar to the relative\n");
- PRINTVALSTREAM(rawoutstream, " path from the group to the excluded object. This \"path\" can be\n");
- PRINTVALSTREAM(rawoutstream, " taken from the first section of the output of the --verbose option.\n");
- PRINTVALSTREAM(rawoutstream, " For example, if you are comparing the group /groupA in two files and\n");
- PRINTVALSTREAM(rawoutstream, " you want to exclude /groupA/groupB/groupC in both files, the exclude\n");
- PRINTVALSTREAM(rawoutstream, " option would read as follows:\n");
- PRINTVALSTREAM(rawoutstream, " --exclude-path \"/groupB/groupC\"\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " If there are multiple paths to an object, only the specified path(s)\n");
- PRINTVALSTREAM(rawoutstream, " will be excluded; the comparison will include any path not explicitly\n");
- PRINTVALSTREAM(rawoutstream, " excluded.\n");
- PRINTVALSTREAM(rawoutstream, " This option can be used repeatedly to exclude multiple paths.\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " --exclude-attribute \"path/to/object/with/attribute\"\n");
- PRINTVALSTREAM(rawoutstream, " Exclude attributes on the specified path to an object when comparing files or groups.\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " If there are multiple paths to an object, only the specified path(s)\n");
- PRINTVALSTREAM(rawoutstream, " will be excluded; the comparison will include any path not explicitly\n");
- PRINTVALSTREAM(rawoutstream, " excluded.\n");
- PRINTVALSTREAM(rawoutstream, " This option can be used repeatedly to exclude multiple paths.\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " Modes of output:\n");
- PRINTVALSTREAM(rawoutstream, " Default mode: print the number of differences found and where they occured\n");
- PRINTVALSTREAM(rawoutstream, " -r Report mode: print the above plus the differences\n");
- PRINTVALSTREAM(rawoutstream, " -v Verbose mode: print the above plus a list of objects and warnings\n");
- PRINTVALSTREAM(rawoutstream, " -q Quiet mode: do not print output\n");
-
- PRINTVALSTREAM(rawoutstream, "\n");
-
- PRINTVALSTREAM(rawoutstream, " File comparison:\n");
- PRINTVALSTREAM(rawoutstream, " If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as\n");
- PRINTVALSTREAM(rawoutstream, " a comparison of the two files' root groups. That is, h5diff first compares\n");
- PRINTVALSTREAM(rawoutstream, " the names of root group members, generates a report of root group objects\n");
- PRINTVALSTREAM(rawoutstream, " that appear in only one file or in both files, and recursively compares\n");
- PRINTVALSTREAM(rawoutstream, " common objects.\n");
- PRINTVALSTREAM(rawoutstream, "\n");
-
- PRINTVALSTREAM(rawoutstream, " Object comparison:\n");
- PRINTVALSTREAM(rawoutstream, " 1) Groups\n");
- PRINTVALSTREAM(rawoutstream, " First compares the names of member objects (relative path, from the\n");
- PRINTVALSTREAM(rawoutstream, " specified group) and generates a report of objects that appear in only\n");
- PRINTVALSTREAM(rawoutstream, " one group or in both groups. Common objects are then compared recursively.\n");
- PRINTVALSTREAM(rawoutstream, " 2) Datasets\n");
- PRINTVALSTREAM(rawoutstream, " Array rank and dimensions, datatypes, and data values are compared.\n");
- PRINTVALSTREAM(rawoutstream, " 3) Datatypes\n");
- PRINTVALSTREAM(rawoutstream, " The comparison is based on the return value of H5Tequal.\n");
- PRINTVALSTREAM(rawoutstream, " 4) Symbolic links\n");
- PRINTVALSTREAM(rawoutstream, " The paths to the target objects are compared.\n");
- PRINTVALSTREAM(rawoutstream, " (The option --follow-symlinks overrides the default behavior when\n");
- PRINTVALSTREAM(rawoutstream, " symbolic links are compared.).\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- /*
- * TRILABS_227 is complete except for an issue with printing indices
- * the following will be needed for subsetting
- PRINTVALSTREAM(rawoutstream, " Subsetting options:\n");
- PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the fcompact form of subsetting, as follows:\n");
- PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]\n");
- PRINTVALSTREAM(rawoutstream, " It is not required to use all parameters, but until the last parameter value used,\n");
- PRINTVALSTREAM(rawoutstream, " all of the semicolons (;) are required, even when a parameter value is not specified. Example:\n");
- PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;;COUNT;BLOCK]\n");
- PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START]\n");
- PRINTVALSTREAM(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n");
- PRINTVALSTREAM(rawoutstream, " each dimension. START is optional and will default to 0 in each dimension.\n");
- PRINTVALSTREAM(rawoutstream, " Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with\n");
- PRINTVALSTREAM(rawoutstream, " one integer for each dimension of the dataset.\n");
- PRINTVALSTREAM(rawoutstream, "\n");
-*/
- PRINTVALSTREAM(rawoutstream, " Exit code:\n");
- PRINTVALSTREAM(rawoutstream, " 0 if no differences, 1 if differences found, 2 if error\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " Examples of use:\n");
- PRINTVALSTREAM(rawoutstream, " 1) h5diff file1 file2 /g1/dset1 /g1/dset2\n");
- PRINTVALSTREAM(rawoutstream, " Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 2) h5diff file1 file2 /g1/dset1\n");
- PRINTVALSTREAM(rawoutstream, " Compares object '/g1/dset1' in both files\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 3) h5diff file1 file2\n");
- PRINTVALSTREAM(rawoutstream, " Compares all objects in both files\n");
- PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " Notes:\n");
- PRINTVALSTREAM(rawoutstream, " file1 and file2 can be the same file.\n");
- PRINTVALSTREAM(rawoutstream, " Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare\n");
- PRINTVALSTREAM(rawoutstream, " '/g1/dset1' and '/g1/dset2' in the same file\n");
- PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]\n");
+ PRINTVALSTREAM(rawoutstream, " file1 File name of the first HDF5 file\n");
+ PRINTVALSTREAM(rawoutstream, " file2 File name of the second HDF5 file\n");
+ PRINTVALSTREAM(rawoutstream, " [obj1] Name of an HDF5 object, in absolute path\n");
+ PRINTVALSTREAM(rawoutstream, " [obj2] Name of an HDF5 object, in absolute path\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
+ PRINTVALSTREAM(rawoutstream, " -h, --help\n");
+ PRINTVALSTREAM(rawoutstream, " Print a usage message and exit.\n");
+ PRINTVALSTREAM(rawoutstream, " -V, --version\n");
+ PRINTVALSTREAM(rawoutstream, " Print version number and exit.\n");
+ PRINTVALSTREAM(rawoutstream, " -r, --report\n");
+ PRINTVALSTREAM(rawoutstream, " Report mode. Print differences.\n");
+ PRINTVALSTREAM(rawoutstream, " -v --verbose\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Verbose mode. Print differences information and list of objects.\n");
+ PRINTVALSTREAM(rawoutstream, " -vN --verbose=N\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Verbose mode with level. Print differences and list of objects.\n");
+ PRINTVALSTREAM(rawoutstream, " Level of detail depends on value of N:\n");
+ PRINTVALSTREAM(rawoutstream, " 0 : Identical to '-v' or '--verbose'.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " 1 : All level 0 information plus one-line attribute status summary.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " 2 : All level 1 information plus extended attribute status report.\n");
+ PRINTVALSTREAM(rawoutstream, " 3 : All level 2 information plus file names.\n");
+ PRINTVALSTREAM(rawoutstream, " -q, --quiet\n");
+ PRINTVALSTREAM(rawoutstream, " Quiet mode. Do not produce output.\n");
+ PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Prints messages from the HDF5 error stack as they occur.\n");
+ PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Follow symbolic links (soft links and external links and compare the)\n");
+ PRINTVALSTREAM(rawoutstream, " links' target objects.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If symbolic link(s) with the same name exist in the files being\n");
+ PRINTVALSTREAM(rawoutstream,
+ " compared, then determine whether the target of each link is an existing\n");
+ PRINTVALSTREAM(rawoutstream,
+ " object (dataset, group, or named datatype) or the link is a dangling\n");
+ PRINTVALSTREAM(rawoutstream,
+ " link (a soft or external link pointing to a target object that does\n");
+ PRINTVALSTREAM(rawoutstream, " not yet exist).\n");
+ PRINTVALSTREAM(rawoutstream,
+ " - If both symbolic links are dangling links, they are treated as being\n");
+ PRINTVALSTREAM(rawoutstream, " the same; by default, h5diff returns an exit code of 0.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If, however, --no-dangling-links is used with --follow-symlinks,\n");
+ PRINTVALSTREAM(rawoutstream, " this situation is treated as an error and h5diff returns an\n");
+ PRINTVALSTREAM(rawoutstream, " exit code of 2.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " - If only one of the two links is a dangling link,they are treated as\n");
+ PRINTVALSTREAM(rawoutstream, " being different and h5diff returns an exit code of 1.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If, however, --no-dangling-links is used with --follow-symlinks,\n");
+ PRINTVALSTREAM(rawoutstream, " this situation is treated as an error and h5diff returns an\n");
+ PRINTVALSTREAM(rawoutstream, " exit code of 2.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " - If both symbolic links point to existing objects, h5diff compares the\n");
+ PRINTVALSTREAM(rawoutstream, " two objects.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If any symbolic link specified in the call to h5diff does not exist,\n");
+ PRINTVALSTREAM(rawoutstream, " h5diff treats it as an error and returns an exit code of 2.\n");
+ PRINTVALSTREAM(rawoutstream, " --no-dangling-links\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Must be used with --follow-symlinks option; otherwise, h5diff shows\n");
+ PRINTVALSTREAM(rawoutstream, " error message and returns an exit code of 2.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Check for any symbolic links (soft links or external links) that do not\n");
+ PRINTVALSTREAM(rawoutstream,
+ " resolve to an existing object (dataset, group, or named datatype).\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If any dangling link is found, this situation is treated as an error\n");
+ PRINTVALSTREAM(rawoutstream, " and h5diff returns an exit code of 2.\n");
+ PRINTVALSTREAM(rawoutstream, " -c, --compare\n");
+ PRINTVALSTREAM(rawoutstream, " List objects that are not comparable\n");
+ PRINTVALSTREAM(rawoutstream, " -N, --nan\n");
+ PRINTVALSTREAM(rawoutstream, " Avoid NaNs detection\n");
+ PRINTVALSTREAM(rawoutstream, " -n C, --count=C\n");
+ PRINTVALSTREAM(rawoutstream, " Print differences up to C. C must be a positive integer.\n");
+ PRINTVALSTREAM(rawoutstream, " -d D, --delta=D\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Print difference if (|a-b| > D). D must be a positive number. Where a\n");
+ PRINTVALSTREAM(rawoutstream,
+ " is the data point value in file1 and b is the data point value in file2.\n");
+ PRINTVALSTREAM(rawoutstream, " Can not use with '-p' or '--use-system-epsilon'.\n");
+ PRINTVALSTREAM(rawoutstream, " -p R, --relative=R\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Print difference if (|(a-b)/b| > R). R must be a positive number. Where a\n");
+ PRINTVALSTREAM(rawoutstream,
+ " is the data point value in file1 and b is the data point value in file2.\n");
+ PRINTVALSTREAM(rawoutstream, " Can not use with '-d' or '--use-system-epsilon'.\n");
+ PRINTVALSTREAM(rawoutstream, " --use-system-epsilon\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " Print difference if (|a-b| > EPSILON), EPSILON is system defined value. Where a\n");
+ PRINTVALSTREAM(rawoutstream,
+ " is the data point value in file1 and b is the data point value in file2.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If the system epsilon is not defined,one of the following predefined\n");
+ PRINTVALSTREAM(rawoutstream, " values will be used:\n");
+ PRINTVALSTREAM(rawoutstream, " FLT_EPSILON = 1.19209E-07 for floating-point type\n");
+ PRINTVALSTREAM(rawoutstream, " DBL_EPSILON = 2.22045E-16 for double precision type\n");
+ PRINTVALSTREAM(rawoutstream, " Can not use with '-p' or '-d'.\n");
+ PRINTVALSTREAM(rawoutstream, " --exclude-path \"path\"\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Exclude the specified path to an object when comparing files or groups.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If a group is excluded, all member objects will also be excluded.\n");
+ PRINTVALSTREAM(rawoutstream, " The specified path is excluded wherever it occurs.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " This flexibility enables the same option to exclude either objects that\n");
+ PRINTVALSTREAM(rawoutstream,
+ " exist only in one file or common objects that are known to differ.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream,
+ " When comparing files, \"path\" is the absolute path to the excluded;\n");
+ PRINTVALSTREAM(rawoutstream,
+ " object; when comparing groups, \"path\" is similar to the relative\n");
+ PRINTVALSTREAM(rawoutstream,
+ " path from the group to the excluded object. This \"path\" can be\n");
+ PRINTVALSTREAM(rawoutstream,
+ " taken from the first section of the output of the --verbose option.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " For example, if you are comparing the group /groupA in two files and\n");
+ PRINTVALSTREAM(rawoutstream,
+ " you want to exclude /groupA/groupB/groupC in both files, the exclude\n");
+ PRINTVALSTREAM(rawoutstream, " option would read as follows:\n");
+ PRINTVALSTREAM(rawoutstream, " --exclude-path \"/groupB/groupC\"\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If there are multiple paths to an object, only the specified path(s)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " will be excluded; the comparison will include any path not explicitly\n");
+ PRINTVALSTREAM(rawoutstream, " excluded.\n");
+ PRINTVALSTREAM(rawoutstream, " This option can be used repeatedly to exclude multiple paths.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " --exclude-attribute \"path/to/object/with/attribute\"\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " Exclude attributes on the specified path to an object when comparing files or groups.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If there are multiple paths to an object, only the specified path(s)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " will be excluded; the comparison will include any path not explicitly\n");
+ PRINTVALSTREAM(rawoutstream, " excluded.\n");
+ PRINTVALSTREAM(rawoutstream, " This option can be used repeatedly to exclude multiple paths.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Modes of output:\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Default mode: print the number of differences found and where they occured\n");
+ PRINTVALSTREAM(rawoutstream, " -r Report mode: print the above plus the differences\n");
+ PRINTVALSTREAM(rawoutstream, " -v Verbose mode: print the above plus a list of objects and warnings\n");
+ PRINTVALSTREAM(rawoutstream, " -q Quiet mode: do not print output\n");
+
+ PRINTVALSTREAM(rawoutstream, "\n");
+
+ PRINTVALSTREAM(rawoutstream, " File comparison:\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If no objects [obj1[ obj2]] are specified, the h5diff comparison proceeds as\n");
+ PRINTVALSTREAM(rawoutstream,
+ " a comparison of the two files' root groups. That is, h5diff first compares\n");
+ PRINTVALSTREAM(rawoutstream,
+ " the names of root group members, generates a report of root group objects\n");
+ PRINTVALSTREAM(rawoutstream,
+ " that appear in only one file or in both files, and recursively compares\n");
+ PRINTVALSTREAM(rawoutstream, " common objects.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+
+ PRINTVALSTREAM(rawoutstream, " Object comparison:\n");
+ PRINTVALSTREAM(rawoutstream, " 1) Groups\n");
+ PRINTVALSTREAM(rawoutstream,
+ " First compares the names of member objects (relative path, from the\n");
+ PRINTVALSTREAM(rawoutstream,
+ " specified group) and generates a report of objects that appear in only\n");
+ PRINTVALSTREAM(rawoutstream,
+ " one group or in both groups. Common objects are then compared recursively.\n");
+ PRINTVALSTREAM(rawoutstream, " 2) Datasets\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Array rank and dimensions, datatypes, and data values are compared.\n");
+ PRINTVALSTREAM(rawoutstream, " 3) Datatypes\n");
+ PRINTVALSTREAM(rawoutstream, " The comparison is based on the return value of H5Tequal.\n");
+ PRINTVALSTREAM(rawoutstream, " 4) Symbolic links\n");
+ PRINTVALSTREAM(rawoutstream, " The paths to the target objects are compared.\n");
+ PRINTVALSTREAM(rawoutstream, " (The option --follow-symlinks overrides the default behavior when\n");
+ PRINTVALSTREAM(rawoutstream, " symbolic links are compared.).\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ /*
+ * TRILABS_227 is complete except for an issue with printing indices
+ * the following will be needed for subsetting
+ PRINTVALSTREAM(rawoutstream, " Subsetting options:\n");
+ PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the fcompact form of subsetting, as
+ follows:\n"); PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]\n");
+ PRINTVALSTREAM(rawoutstream, " It is not required to use all parameters, but until the last parameter
+ value used,\n"); PRINTVALSTREAM(rawoutstream, " all of the semicolons (;) are required, even when a
+ parameter value is not specified. Example:\n"); PRINTVALSTREAM(rawoutstream, " obj1
+ /foo/mydataset[START;;COUNT;BLOCK]\n"); PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START]\n");
+ PRINTVALSTREAM(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1
+ in\n"); PRINTVALSTREAM(rawoutstream, " each dimension. START is optional and will default to 0 in each
+ dimension.\n"); PRINTVALSTREAM(rawoutstream, " Each of START, STRIDE, COUNT, and BLOCK must be a
+ comma-separated list of integers with\n"); PRINTVALSTREAM(rawoutstream, " one integer for each dimension
+ of the dataset.\n"); PRINTVALSTREAM(rawoutstream, "\n");
+ */
+ PRINTVALSTREAM(rawoutstream, " Exit code:\n");
+ PRINTVALSTREAM(rawoutstream, " 0 if no differences, 1 if differences found, 2 if error\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Examples of use:\n");
+ PRINTVALSTREAM(rawoutstream, " 1) h5diff file1 file2 /g1/dset1 /g1/dset2\n");
+ PRINTVALSTREAM(rawoutstream, " Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " 2) h5diff file1 file2 /g1/dset1\n");
+ PRINTVALSTREAM(rawoutstream, " Compares object '/g1/dset1' in both files\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " 3) h5diff file1 file2\n");
+ PRINTVALSTREAM(rawoutstream, " Compares all objects in both files\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Notes:\n");
+ PRINTVALSTREAM(rawoutstream, " file1 and file2 can be the same file.\n");
+ PRINTVALSTREAM(rawoutstream, " Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare\n");
+ PRINTVALSTREAM(rawoutstream, " '/g1/dset1' and '/g1/dset2' in the same file\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
}
diff --git a/tools/src/h5diff/h5diff_common.h b/tools/src/h5diff/h5diff_common.h
index dc0676c..b855077 100644
--- a/tools/src/h5diff/h5diff_common.h
+++ b/tools/src/h5diff/h5diff_common.h
@@ -23,9 +23,10 @@ extern "C" {
#endif
void usage(void);
-void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* opts);
+void parse_command_line(int argc, const char *argv[], const char **fname1, const char **fname2,
+ const char **objname1, const char **objname2, diff_opt_t *opts);
void h5diff_exit(int status);
-void print_info(diff_opt_t* opts);
+void print_info(diff_opt_t *opts);
#ifdef __cplusplus
}
diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c
index e14447d..c056e35 100644
--- a/tools/src/h5diff/h5diff_main.c
+++ b/tools/src/h5diff/h5diff_main.c
@@ -17,7 +17,6 @@
#include "h5tools.h"
#include "h5tools_utils.h"
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -65,17 +64,17 @@
*-------------------------------------------------------------------------
*/
-
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- int ret;
- int i;
- const char *fname1 = NULL;
- const char *fname2 = NULL;
- const char *objname1 = NULL;
- const char *objname2 = NULL;
- hsize_t nfound=0;
- diff_opt_t opts;
+ int ret;
+ int i;
+ const char *fname1 = NULL;
+ const char *fname2 = NULL;
+ const char *objname1 = NULL;
+ const char *objname2 = NULL;
+ hsize_t nfound = 0;
+ diff_opt_t opts;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -84,28 +83,28 @@ int main(int argc, const char *argv[])
h5tools_init();
/*-------------------------------------------------------------------------
- * process the command-line
- *-------------------------------------------------------------------------
- */
+ * process the command-line
+ *-------------------------------------------------------------------------
+ */
parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
/* enable error reporting if command line option */
h5tools_error_report();
/*-------------------------------------------------------------------------
- * do the diff
- *-------------------------------------------------------------------------
- */
+ * do the diff
+ *-------------------------------------------------------------------------
+ */
nfound = h5diff(fname1, fname2, objname1, objname2, &opts);
print_info(&opts);
- /*-------------------------------------------------------------------------
- * exit code
- * 1 if differences, 0 if no differences, 2 if error
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * exit code
+ * 1 if differences, 0 if no differences, 2 if error
+ *-------------------------------------------------------------------------
+ */
ret = (nfound == 0 ? 0 : 1);
@@ -120,17 +119,17 @@ int main(int argc, const char *argv[])
/* free any buffers */
for (i = 0; i < 2; i++) {
if (opts.sset[i]) {
- if(opts.sset[i]->start.data)
+ if (opts.sset[i]->start.data)
HDfree(opts.sset[i]->start.data);
- if(opts.sset[i]->stride.data)
+ if (opts.sset[i]->stride.data)
HDfree(opts.sset[i]->stride.data);
- if(opts.sset[i]->count.data)
+ if (opts.sset[i]->count.data)
HDfree(opts.sset[i]->count.data);
- if(opts.sset[i]->block.data)
+ if (opts.sset[i]->block.data)
HDfree(opts.sset[i]->block.data);
HDfree(opts.sset[i]);
- opts.sset[i]=NULL;
+ opts.sset[i] = NULL;
}
}
@@ -160,4 +159,3 @@ h5diff_exit(int status)
HDexit(status);
}
-
diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c
index 2336378..de7de96 100644
--- a/tools/src/h5diff/ph5diff_main.c
+++ b/tools/src/h5diff/ph5diff_main.c
@@ -21,7 +21,7 @@
/* Name of tool */
#define PROGRAMNAME "h5diff"
-static void ph5diff_worker(int );
+static void ph5diff_worker(int);
/*-------------------------------------------------------------------------
* Function: main
@@ -43,14 +43,15 @@ static void ph5diff_worker(int );
*-------------------------------------------------------------------------
*/
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- int nID = 0;
- const char *fname1 = NULL;
- const char *fname2 = NULL;
- const char *objname1 = NULL;
- const char *objname2 = NULL;
- diff_opt_t opts;
+ int nID = 0;
+ const char *fname1 = NULL;
+ const char *fname2 = NULL;
+ const char *objname1 = NULL;
+ const char *objname2 = NULL;
+ diff_opt_t opts;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -59,15 +60,14 @@ int main(int argc, const char *argv[])
h5tools_init();
outBuffOffset = 0;
- g_Parallel = 1;
+ g_Parallel = 1;
- MPI_Init(&argc, (char***) &argv);
+ MPI_Init(&argc, (char ***)&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &nID);
MPI_Comm_size(MPI_COMM_WORLD, &g_nTasks);
- if(g_nTasks == 1)
- {
+ if (g_nTasks == 1) {
HDprintf("Only 1 task available...doing serial diff\n");
g_Parallel = 0;
@@ -82,8 +82,7 @@ int main(int argc, const char *argv[])
else {
/* Have the manager process the command-line */
- if(nID == 0)
- {
+ if (nID == 0) {
parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
h5diff(fname1, fname2, objname1, objname2, &opts);
@@ -129,31 +128,27 @@ ph5diff_worker(int nID)
hid_t file1_id = H5I_INVALID_HID;
hid_t file2_id = H5I_INVALID_HID;
- while(1)
- {
+ while (1) {
MPI_Status Status;
MPI_Probe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
/* Check for filenames */
- if(Status.MPI_TAG == MPI_TAG_PARALLEL)
- {
- char filenames[2][MAX_FILENAME];
+ if (Status.MPI_TAG == MPI_TAG_PARALLEL) {
+ char filenames[2][MAX_FILENAME];
/* Retrieve filenames */
- MPI_Recv(filenames, MAX_FILENAME*2, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
+ MPI_Recv(filenames, MAX_FILENAME * 2, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status);
/* disable error reporting */
H5E_BEGIN_TRY
{
/* Open the files */
- if ((file1_id = H5Fopen (filenames[0], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- {
+ if ((file1_id = H5Fopen(filenames[0], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
HDprintf("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[0]);
MPI_Abort(MPI_COMM_WORLD, 0);
}
- if ((file2_id = H5Fopen (filenames[1], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
- {
+ if ((file2_id = H5Fopen(filenames[1], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
HDprintf("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[1]);
MPI_Abort(MPI_COMM_WORLD, 0);
}
@@ -162,15 +157,13 @@ ph5diff_worker(int nID)
H5E_END_TRY;
}
/* Check for work */
- else if(Status.MPI_TAG == MPI_TAG_ARGS)
- {
+ else if (Status.MPI_TAG == MPI_TAG_ARGS) {
struct diff_mpi_args args;
- struct diffs_found diffs;
- unsigned i;
+ struct diffs_found diffs;
+ unsigned i;
/* Make certain we've received the filenames and opened the files already */
- if(file1_id < 0 || file2_id < 0)
- {
+ if (file1_id < 0 || file2_id < 0) {
HDprintf("ph5diff_worker: ERROR: work received before/without filenames\n");
break;
}
@@ -179,44 +172,43 @@ ph5diff_worker(int nID)
MPI_Recv(&args, sizeof(args), MPI_BYTE, 0, MPI_TAG_ARGS, MPI_COMM_WORLD, &Status);
/* Do the diff */
- diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.opts), &(args.argdata));
+ diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.opts), &(args.argdata));
diffs.not_cmp = args.opts.not_cmp;
/* If print buffer has something in it, request print token.*/
- if(outBuffOffset>0)
- {
+ if (outBuffOffset > 0) {
MPI_Send(NULL, 0, MPI_BYTE, 0, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD);
/* Wait for print token. */
MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD, &Status);
/* When get token, send all of our output to the manager task and then return the token */
- for(i=0; i<outBuffOffset; i+=PRINT_DATA_MAX_SIZE)
- MPI_Send(outBuff+i, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD);
+ for (i = 0; i < outBuffOffset; i += PRINT_DATA_MAX_SIZE)
+ MPI_Send(outBuff + i, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA,
+ MPI_COMM_WORLD);
/* An overflow file exists, so we send it's output to the manager too and then delete it */
- if(overflow_file)
- {
+ if (overflow_file) {
char out_data[PRINT_DATA_MAX_SIZE];
- int tmp;
+ int tmp;
HDmemset(out_data, 0, PRINT_DATA_MAX_SIZE);
- i=0;
+ i = 0;
rewind(overflow_file);
- while((tmp = getc(overflow_file)) >= 0)
- {
+ while ((tmp = getc(overflow_file)) >= 0) {
*(out_data + i++) = (char)tmp;
- if(i==PRINT_DATA_MAX_SIZE)
- {
- MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD);
- i=0;
+ if (i == PRINT_DATA_MAX_SIZE) {
+ MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA,
+ MPI_COMM_WORLD);
+ i = 0;
HDmemset(out_data, 0, PRINT_DATA_MAX_SIZE);
}
}
- if(i>0)
- MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD);
+ if (i > 0)
+ MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA,
+ MPI_COMM_WORLD);
fclose(overflow_file);
overflow_file = NULL;
@@ -232,17 +224,14 @@ ph5diff_worker(int nID)
MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_DONE, MPI_COMM_WORLD);
}
/* Check for leaving */
- else if(Status.MPI_TAG == MPI_TAG_END)
- {
+ else if (Status.MPI_TAG == MPI_TAG_END) {
MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_END, MPI_COMM_WORLD, &Status);
break;
}
- else
- {
+ else {
HDprintf("ph5diff_worker: ERROR: invalid tag (%d) received\n", Status.MPI_TAG);
break;
}
-
}
return;
@@ -262,18 +251,17 @@ ph5diff_worker(int nID)
*
*-------------------------------------------------------------------------
*/
-void print_manager_output(void)
+void
+print_manager_output(void)
{
/* If there was something we buffered, let's print it now */
- if( (outBuffOffset>0) && g_Parallel)
- {
+ if ((outBuffOffset > 0) && g_Parallel) {
HDprintf("%s", outBuff);
- if(overflow_file)
- {
- int tmp;
+ if (overflow_file) {
+ int tmp;
rewind(overflow_file);
- while((tmp = HDgetc(overflow_file)) >= 0)
+ while ((tmp = HDgetc(overflow_file)) >= 0)
HDputchar(tmp);
fclose(overflow_file);
overflow_file = NULL;
@@ -283,8 +271,7 @@ void print_manager_output(void)
HDmemset(outBuff, 0, OUTBUFF_SIZE);
outBuffOffset = 0;
}
- else if( (outBuffOffset>0) && !g_Parallel)
- {
+ else if ((outBuffOffset > 0) && !g_Parallel) {
HDfprintf(stderr, "h5diff error: outBuffOffset>0, but we're not in parallel!\n");
}
}
@@ -305,16 +292,18 @@ void print_manager_output(void)
*
*-------------------------------------------------------------------------
*/
-void h5diff_exit(int status)
+void
+h5diff_exit(int status)
{
/* if in parallel mode, dismiss workers, close down MPI, then exit */
- if(g_Parallel) {
- if(g_nTasks > 1) {
+ if (g_Parallel) {
+ if (g_nTasks > 1) {
phdiff_dismiss_workers();
MPI_Barrier(MPI_COMM_WORLD);
}
MPI_Finalize();
- status = EXIT_SUCCESS; /* Reset exit status, since some mpiexec commands generate output on failure status */
+ status = EXIT_SUCCESS; /* Reset exit status, since some mpiexec commands generate output on failure
+ status */
}
h5tools_close();
@@ -324,4 +313,3 @@ void h5diff_exit(int status)
*/
HDexit(0);
}
-
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index f30d8fd..8bace61 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -18,11 +18,11 @@
/* Name of tool */
#define PROGRAMNAME "h5dump"
-static const char *driver_name_g = NULL; /* The driver to open the file with. */
-const char *outfname_g = NULL;
-static hbool_t doxml_g = FALSE;
-static hbool_t useschema_g = TRUE;
-static const char *xml_dtd_uri_g = NULL;
+static const char *driver_name_g = NULL; /* The driver to open the file with. */
+const char * outfname_g = NULL;
+static hbool_t doxml_g = FALSE;
+static hbool_t useschema_g = TRUE;
+static const char *xml_dtd_uri_g = NULL;
#ifdef H5_HAVE_ROS3_VFD
/* Default "anonymous" S3 configuration */
@@ -48,38 +48,25 @@ static H5FD_hdfs_fapl_t hdfs_fa_g = {
#endif /* H5_HAVE_LIBHDFS */
/* module-scoped variables for XML option */
-#define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd"
-#define DEFAULT_DTD "http://www.hdfgroup.org/HDF5/XML/DTD/HDF5-File.dtd"
+#define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd"
+#define DEFAULT_DTD "http://www.hdfgroup.org/HDF5/XML/DTD/HDF5-File.dtd"
/* Standard DDL output */
static const dump_functions ddl_function_table = {
- dump_group,
- dump_named_datatype,
- dump_dataset,
- dump_dataspace,
- dump_datatype,
- dump_attr_cb,
- dump_data
-};
+ dump_group, dump_named_datatype, dump_dataset, dump_dataspace, dump_datatype, dump_attr_cb, dump_data};
/* XML output */
static const dump_functions xml_function_table = {
- xml_dump_group,
- xml_dump_named_datatype,
- xml_dump_dataset,
- xml_dump_dataspace,
- xml_dump_datatype,
- xml_dump_attr,
- xml_dump_data
-};
+ xml_dump_group, xml_dump_named_datatype, xml_dump_dataset, xml_dump_dataspace,
+ xml_dump_datatype, xml_dump_attr, xml_dump_data};
/* internal functions */
-static void init_prefix(char **prfx, size_t prfx_len);
+static void init_prefix(char **prfx, size_t prfx_len);
/* a structure for handling the order command-line parameters come in */
struct handler_t {
void (*func)(hid_t, const char *, void *, int, const char *);
- char *obj;
+ char * obj;
struct subset_t *subset_info;
};
@@ -90,132 +77,129 @@ struct handler_t {
*/
/* The following initialization makes use of C language concatenating */
/* "xxx" "yyy" into "xxxyyy". */
-static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RE*CM:O*N:vG:";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "hel", no_arg, 'h' },
- { "contents", optional_arg, 'n' },
- { "properties", no_arg, 'p' },
- { "superblock", no_arg, 'B' },
- { "boot-block", no_arg, 'B' },
- { "boot-bloc", no_arg, 'B' },
- { "boot-blo", no_arg, 'B' },
- { "boot-bl", no_arg, 'B' },
- { "boot-b", no_arg, 'B' },
- { "boot", no_arg, 'B' },
- { "boo", no_arg, 'B' },
- { "bo", no_arg, 'B' },
- { "header", no_arg, 'H' },
- { "heade", no_arg, 'H' },
- { "head", no_arg, 'H' },
- { "hea", no_arg, 'H' },
- { "object-ids", no_arg, 'i' },
- { "object-id", no_arg, 'i' },
- { "object-i", no_arg, 'i' },
- { "object", no_arg, 'i' },
- { "objec", no_arg, 'i' },
- { "obje", no_arg, 'i' },
- { "obj", no_arg, 'i' },
- { "ob", no_arg, 'i' },
- { "version", no_arg, 'V' },
- { "versio", no_arg, 'V' },
- { "versi", no_arg, 'V' },
- { "vers", no_arg, 'V' },
- { "ver", no_arg, 'V' },
- { "ve", no_arg, 'V' },
- { "attribute", require_arg, 'a' },
- { "attribut", require_arg, 'a' },
- { "attribu", require_arg, 'a' },
- { "attrib", require_arg, 'a' },
- { "attri", require_arg, 'a' },
- { "attr", require_arg, 'a' },
- { "att", require_arg, 'a' },
- { "at", require_arg, 'a' },
- { "block", require_arg, 'k' },
- { "bloc", require_arg, 'k' },
- { "blo", require_arg, 'k' },
- { "bl", require_arg, 'k' },
- { "count", require_arg, 'c' },
- { "coun", require_arg, 'c' },
- { "cou", require_arg, 'c' },
- { "co", require_arg, 'c' },
- { "dataset", require_arg, 'd' },
- { "datase", require_arg, 'd' },
- { "datas", require_arg, 'd' },
- { "datatype", require_arg, 't' },
- { "datatyp", require_arg, 't' },
- { "dataty", require_arg, 't' },
- { "datat", require_arg, 't' },
- { "filedriver", require_arg, 'f' },
- { "filedrive", require_arg, 'f' },
- { "filedriv", require_arg, 'f' },
- { "filedri", require_arg, 'f' },
- { "filedr", require_arg, 'f' },
- { "filed", require_arg, 'f' },
- { "file", require_arg, 'f' },
- { "fil", require_arg, 'f' },
- { "fi", require_arg, 'f' },
- { "group", require_arg, 'g' },
- { "grou", require_arg, 'g' },
- { "gro", require_arg, 'g' },
- { "gr", require_arg, 'g' },
- { "output", optional_arg, 'o' },
- { "outpu", optional_arg, 'o' },
- { "outp", optional_arg, 'o' },
- { "out", optional_arg, 'o' },
- { "ou", optional_arg, 'o' },
- { "soft-link", require_arg, 'l' },
- { "soft-lin", require_arg, 'l' },
- { "soft-li", require_arg, 'l' },
- { "soft-l", require_arg, 'l' },
- { "soft", require_arg, 'l' },
- { "sof", require_arg, 'l' },
- { "start", require_arg, 's' },
- { "star", require_arg, 's' },
- { "sta", require_arg, 's' },
- { "stride", require_arg, 'S' },
- { "strid", require_arg, 'S' },
- { "string", no_arg, 'r' },
- { "strin", no_arg, 'r' },
- { "use-dtd", no_arg, 'u' },
- { "use-dt", no_arg, 'u' },
- { "use-d", no_arg, 'u' },
- { "use-", no_arg, 'u' },
- { "use", no_arg, 'u' },
- { "us", no_arg, 'u' },
- { "u", no_arg, 'u' },
- { "width", require_arg, 'w' },
- { "widt", require_arg, 'w' },
- { "wid", require_arg, 'w' },
- { "wi", require_arg, 'w' },
- { "xml-dtd", require_arg, 'D' },
- { "xml-dt", require_arg, 'D' },
- { "xml-d", require_arg, 'D' },
- { "xml-ns", require_arg, 'X' },
- { "xml-n", require_arg, 'X' },
- { "xml", no_arg, 'x' },
- { "xm", no_arg, 'x' },
- { "onlyattr", optional_arg, 'A' },
- { "escape", no_arg, 'e' },
- { "noindex", no_arg, 'y' },
- { "binary", optional_arg, 'b' },
- { "form", require_arg, 'F' },
- { "sort_by", require_arg, 'q' },
- { "sort_order", require_arg, 'z' },
- { "format", require_arg, 'm' },
- { "region", no_arg, 'R' },
- { "enable-error-stack", optional_arg, 'E' },
- { "packed-bits", require_arg, 'M' },
- { "no-compact-subset", no_arg, 'C' },
- { "ddl", optional_arg, 'O' },
- { "any_path", require_arg, 'N' },
- { "vds-view-first-missing", no_arg, 'v' },
- { "vds-gap-size", require_arg, 'G' },
- { "s3-cred", require_arg, '$' },
- { "hdfs-attrs", require_arg, '#' },
- { NULL, 0, '\0' }
-};
-
+static const char * s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RE*CM:O*N:vG:";
+static struct long_options l_opts[] = {{"help", no_arg, 'h'},
+ {"hel", no_arg, 'h'},
+ {"contents", optional_arg, 'n'},
+ {"properties", no_arg, 'p'},
+ {"superblock", no_arg, 'B'},
+ {"boot-block", no_arg, 'B'},
+ {"boot-bloc", no_arg, 'B'},
+ {"boot-blo", no_arg, 'B'},
+ {"boot-bl", no_arg, 'B'},
+ {"boot-b", no_arg, 'B'},
+ {"boot", no_arg, 'B'},
+ {"boo", no_arg, 'B'},
+ {"bo", no_arg, 'B'},
+ {"header", no_arg, 'H'},
+ {"heade", no_arg, 'H'},
+ {"head", no_arg, 'H'},
+ {"hea", no_arg, 'H'},
+ {"object-ids", no_arg, 'i'},
+ {"object-id", no_arg, 'i'},
+ {"object-i", no_arg, 'i'},
+ {"object", no_arg, 'i'},
+ {"objec", no_arg, 'i'},
+ {"obje", no_arg, 'i'},
+ {"obj", no_arg, 'i'},
+ {"ob", no_arg, 'i'},
+ {"version", no_arg, 'V'},
+ {"versio", no_arg, 'V'},
+ {"versi", no_arg, 'V'},
+ {"vers", no_arg, 'V'},
+ {"ver", no_arg, 'V'},
+ {"ve", no_arg, 'V'},
+ {"attribute", require_arg, 'a'},
+ {"attribut", require_arg, 'a'},
+ {"attribu", require_arg, 'a'},
+ {"attrib", require_arg, 'a'},
+ {"attri", require_arg, 'a'},
+ {"attr", require_arg, 'a'},
+ {"att", require_arg, 'a'},
+ {"at", require_arg, 'a'},
+ {"block", require_arg, 'k'},
+ {"bloc", require_arg, 'k'},
+ {"blo", require_arg, 'k'},
+ {"bl", require_arg, 'k'},
+ {"count", require_arg, 'c'},
+ {"coun", require_arg, 'c'},
+ {"cou", require_arg, 'c'},
+ {"co", require_arg, 'c'},
+ {"dataset", require_arg, 'd'},
+ {"datase", require_arg, 'd'},
+ {"datas", require_arg, 'd'},
+ {"datatype", require_arg, 't'},
+ {"datatyp", require_arg, 't'},
+ {"dataty", require_arg, 't'},
+ {"datat", require_arg, 't'},
+ {"filedriver", require_arg, 'f'},
+ {"filedrive", require_arg, 'f'},
+ {"filedriv", require_arg, 'f'},
+ {"filedri", require_arg, 'f'},
+ {"filedr", require_arg, 'f'},
+ {"filed", require_arg, 'f'},
+ {"file", require_arg, 'f'},
+ {"fil", require_arg, 'f'},
+ {"fi", require_arg, 'f'},
+ {"group", require_arg, 'g'},
+ {"grou", require_arg, 'g'},
+ {"gro", require_arg, 'g'},
+ {"gr", require_arg, 'g'},
+ {"output", optional_arg, 'o'},
+ {"outpu", optional_arg, 'o'},
+ {"outp", optional_arg, 'o'},
+ {"out", optional_arg, 'o'},
+ {"ou", optional_arg, 'o'},
+ {"soft-link", require_arg, 'l'},
+ {"soft-lin", require_arg, 'l'},
+ {"soft-li", require_arg, 'l'},
+ {"soft-l", require_arg, 'l'},
+ {"soft", require_arg, 'l'},
+ {"sof", require_arg, 'l'},
+ {"start", require_arg, 's'},
+ {"star", require_arg, 's'},
+ {"sta", require_arg, 's'},
+ {"stride", require_arg, 'S'},
+ {"strid", require_arg, 'S'},
+ {"string", no_arg, 'r'},
+ {"strin", no_arg, 'r'},
+ {"use-dtd", no_arg, 'u'},
+ {"use-dt", no_arg, 'u'},
+ {"use-d", no_arg, 'u'},
+ {"use-", no_arg, 'u'},
+ {"use", no_arg, 'u'},
+ {"us", no_arg, 'u'},
+ {"u", no_arg, 'u'},
+ {"width", require_arg, 'w'},
+ {"widt", require_arg, 'w'},
+ {"wid", require_arg, 'w'},
+ {"wi", require_arg, 'w'},
+ {"xml-dtd", require_arg, 'D'},
+ {"xml-dt", require_arg, 'D'},
+ {"xml-d", require_arg, 'D'},
+ {"xml-ns", require_arg, 'X'},
+ {"xml-n", require_arg, 'X'},
+ {"xml", no_arg, 'x'},
+ {"xm", no_arg, 'x'},
+ {"onlyattr", optional_arg, 'A'},
+ {"escape", no_arg, 'e'},
+ {"noindex", no_arg, 'y'},
+ {"binary", optional_arg, 'b'},
+ {"form", require_arg, 'F'},
+ {"sort_by", require_arg, 'q'},
+ {"sort_order", require_arg, 'z'},
+ {"format", require_arg, 'm'},
+ {"region", no_arg, 'R'},
+ {"enable-error-stack", optional_arg, 'E'},
+ {"packed-bits", require_arg, 'M'},
+ {"no-compact-subset", no_arg, 'C'},
+ {"ddl", optional_arg, 'O'},
+ {"any_path", require_arg, 'N'},
+ {"vds-view-first-missing", no_arg, 'v'},
+ {"vds-gap-size", require_arg, 'G'},
+ {"s3-cred", require_arg, '$'},
+ {"hdfs-attrs", require_arg, '#'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: leave
@@ -233,7 +217,6 @@ leave(int ret)
HDexit(ret);
}
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -259,40 +242,59 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " -o F, --output=F Output raw data into file F\n");
PRINTVALSTREAM(rawoutstream, " -b B, --binary=B Binary file output, of form B\n");
PRINTVALSTREAM(rawoutstream, " -O F, --ddl=F Output ddl text into file F\n");
- PRINTVALSTREAM(rawoutstream, " Use blank(empty) filename F to suppress ddl display\n");
- PRINTVALSTREAM(rawoutstream, " --s3-cred=<cred> Supply S3 authentication information to \"ros3\" vfd.\n");
- PRINTVALSTREAM(rawoutstream, " <cred> :: \"(<aws-region>,<access-id>,<access-key>)\"\n");
- PRINTVALSTREAM(rawoutstream, " If absent or <cred> -> \"(,,)\", no authentication.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Use blank(empty) filename F to suppress ddl display\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --s3-cred=<cred> Supply S3 authentication information to \"ros3\" vfd.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " <cred> :: \"(<aws-region>,<access-id>,<access-key>)\"\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If absent or <cred> -> \"(,,)\", no authentication.\n");
PRINTVALSTREAM(rawoutstream, " Has no effect is filedriver is not `ros3'.\n");
- PRINTVALSTREAM(rawoutstream, " --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --hdfs-attrs=<attrs> Supply configuration information for HDFS file access.\n");
PRINTVALSTREAM(rawoutstream, " For use with \"--filedriver=hdfs\"\n");
PRINTVALSTREAM(rawoutstream, " <attrs> :: (<namenode name>,<namenode port>,\n");
PRINTVALSTREAM(rawoutstream, " <kerberos cache path>,<username>,\n");
PRINTVALSTREAM(rawoutstream, " <buffer size>)\n");
- PRINTVALSTREAM(rawoutstream, " Any absent attribute will use a default value.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Any absent attribute will use a default value.\n");
PRINTVALSTREAM(rawoutstream, "--------------- Object Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " -a P, --attribute=P Print the specified attribute\n");
- PRINTVALSTREAM(rawoutstream, " If an attribute name contains a slash (/), escape the\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If an attribute name contains a slash (/), escape the\n");
PRINTVALSTREAM(rawoutstream, " slash with a preceding backslash (\\).\n");
PRINTVALSTREAM(rawoutstream, " (See example section below.)\n");
PRINTVALSTREAM(rawoutstream, " -d P, --dataset=P Print the specified dataset\n");
PRINTVALSTREAM(rawoutstream, " -g P, --group=P Print the specified group and all members\n");
PRINTVALSTREAM(rawoutstream, " -l P, --soft-link=P Print the value(s) of the specified soft link\n");
PRINTVALSTREAM(rawoutstream, " -t P, --datatype=P Print the specified named datatype\n");
- PRINTVALSTREAM(rawoutstream, " -N P, --any_path=P Print any attribute, dataset, group, datatype, or link that matches P\n");
- PRINTVALSTREAM(rawoutstream, " P can be the absolute path or just a relative path.\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " -N P, --any_path=P Print any attribute, dataset, group, datatype, or link that matches P\n");
+ PRINTVALSTREAM(rawoutstream,
+ " P can be the absolute path or just a relative path.\n");
PRINTVALSTREAM(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n");
- PRINTVALSTREAM(rawoutstream, " Optional value 0 suppresses printing attributes.\n");
- PRINTVALSTREAM(rawoutstream, " --vds-view-first-missing Set the VDS bounds to first missing mapped elements.\n");
- PRINTVALSTREAM(rawoutstream, " --vds-gap-size=N Set the missing file gap size, N=non-negative integers\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Optional value 0 suppresses printing attributes.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vds-view-first-missing Set the VDS bounds to first missing mapped elements.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --vds-gap-size=N Set the missing file gap size, N=non-negative integers\n");
PRINTVALSTREAM(rawoutstream, "--------------- Object Property Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " -i, --object-ids Print the object ids\n");
- PRINTVALSTREAM(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n");
- PRINTVALSTREAM(rawoutstream, " -M L, --packedbits=L Print packed bits as unsigned integers, using mask\n");
- PRINTVALSTREAM(rawoutstream, " format L for an integer dataset specified with\n");
- PRINTVALSTREAM(rawoutstream, " option -d. L is a list of offset,length values,\n");
- PRINTVALSTREAM(rawoutstream, " separated by commas. Offset is the beginning bit in\n");
- PRINTVALSTREAM(rawoutstream, " the data value and length is the number of bits of\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -p, --properties Print dataset filters, storage layout and fill value\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -M L, --packedbits=L Print packed bits as unsigned integers, using mask\n");
+ PRINTVALSTREAM(rawoutstream,
+ " format L for an integer dataset specified with\n");
+ PRINTVALSTREAM(rawoutstream,
+ " option -d. L is a list of offset,length values,\n");
+ PRINTVALSTREAM(rawoutstream,
+ " separated by commas. Offset is the beginning bit in\n");
+ PRINTVALSTREAM(rawoutstream,
+ " the data value and length is the number of bits of\n");
PRINTVALSTREAM(rawoutstream, " the mask.\n");
PRINTVALSTREAM(rawoutstream, " -R, --region Print dataset pointed by region references\n");
PRINTVALSTREAM(rawoutstream, "--------------- Formatting Options ---------------\n");
@@ -302,12 +304,17 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " -m T, --format=T Set the floating point output format\n");
PRINTVALSTREAM(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n");
PRINTVALSTREAM(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n");
- PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n");
- PRINTVALSTREAM(rawoutstream, " Optional value 2 also prints file open errors.\n");
- PRINTVALSTREAM(rawoutstream, " --no-compact-subset Disable compact form of subsetting and allow the use\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Optional value 2 also prints file open errors.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --no-compact-subset Disable compact form of subsetting and allow the use\n");
PRINTVALSTREAM(rawoutstream, " of \"[\" in dataset names.\n");
- PRINTVALSTREAM(rawoutstream, " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n");
- PRINTVALSTREAM(rawoutstream, " sets the number of columns to the maximum (65535).\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -w N, --width=N Set the number of columns of output. A value of 0 (zero)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " sets the number of columns to the maximum (65535).\n");
PRINTVALSTREAM(rawoutstream, " Default width is 80 columns.\n");
PRINTVALSTREAM(rawoutstream, "--------------- XML Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " -x, --xml Output in XML using Schema\n");
@@ -315,31 +322,44 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " -D U, --xml-dtd=U Use the DTD or schema at U\n");
PRINTVALSTREAM(rawoutstream, " -X S, --xml-ns=S (XML Schema) Use qualified names n the XML\n");
PRINTVALSTREAM(rawoutstream, " \":\": no namespace, default: \"hdf5:\"\n");
- PRINTVALSTREAM(rawoutstream, " E.g., to dump a file called `-f', use h5dump -- -f\n");
+ PRINTVALSTREAM(rawoutstream,
+ " E.g., to dump a file called `-f', use h5dump -- -f\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "--------------- Subsetting Options ---------------\n");
PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the following options with a dataset\n");
PRINTVALSTREAM(rawoutstream, " option. Subsetting is done by selecting a hyperslab from the data.\n");
PRINTVALSTREAM(rawoutstream, " Thus, the options mirror those for performing a hyperslab selection.\n");
- PRINTVALSTREAM(rawoutstream, " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n");
- PRINTVALSTREAM(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n");
- PRINTVALSTREAM(rawoutstream, " each dimension. START is optional and will default to 0 in each dimension.\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " One of the START, COUNT, STRIDE, or BLOCK parameters are mandatory if you do subsetting.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n");
+ PRINTVALSTREAM(rawoutstream,
+ " each dimension. START is optional and will default to 0 in each dimension.\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " -s START, --start=START Offset of start of subsetting selection\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -s START, --start=START Offset of start of subsetting selection\n");
PRINTVALSTREAM(rawoutstream, " -S STRIDE, --stride=STRIDE Hyperslab stride\n");
- PRINTVALSTREAM(rawoutstream, " -c COUNT, --count=COUNT Number of blocks to include in selection\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -c COUNT, --count=COUNT Number of blocks to include in selection\n");
PRINTVALSTREAM(rawoutstream, " -k BLOCK, --block=BLOCK Size of block in hyperslab\n");
- PRINTVALSTREAM(rawoutstream, " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " START, COUNT, STRIDE, and BLOCK - is a list of integers the number of which are equal to the\n");
PRINTVALSTREAM(rawoutstream, " number of dimensions in the dataspace being queried\n");
- PRINTVALSTREAM(rawoutstream, " (Alternate compact form of subsetting is described in the Reference Manual)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " (Alternate compact form of subsetting is described in the Reference Manual)\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "--------------- Option Argument Conventions ---------------\n");
PRINTVALSTREAM(rawoutstream, " D - is the file driver to use in opening the file. Acceptable values\n");
- PRINTVALSTREAM(rawoutstream, " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " are \"sec2\", \"family\", \"split\", \"multi\", \"direct\", and \"stream\". Without\n");
PRINTVALSTREAM(rawoutstream, " the file driver flag, the file will be opened with each driver in\n");
PRINTVALSTREAM(rawoutstream, " turn and in the order specified above until one driver succeeds\n");
PRINTVALSTREAM(rawoutstream, " in opening the file.\n");
- PRINTVALSTREAM(rawoutstream, " See examples below for family, split, and multi driver special file name usage.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " See examples below for family, split, and multi driver special file name usage.\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " F - is a filename.\n");
PRINTVALSTREAM(rawoutstream, " P - is the full path from the root group to the object.\n");
@@ -347,12 +367,17 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " T - is a string containing the floating point format, e.g '%%.3f'\n");
PRINTVALSTREAM(rawoutstream, " U - is a URI reference (as defined in [IETF RFC 2396],\n");
PRINTVALSTREAM(rawoutstream, " updated by [IETF RFC 2732])\n");
- PRINTVALSTREAM(rawoutstream, " B - is the form of binary output: NATIVE for a memory type, FILE for the\n");
- PRINTVALSTREAM(rawoutstream, " file type, LE or BE for pre-existing little or big endian types.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " B - is the form of binary output: NATIVE for a memory type, FILE for the\n");
+ PRINTVALSTREAM(rawoutstream,
+ " file type, LE or BE for pre-existing little or big endian types.\n");
PRINTVALSTREAM(rawoutstream, " Must be used with -o (output file) and it is recommended that\n");
- PRINTVALSTREAM(rawoutstream, " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n");
- PRINTVALSTREAM(rawoutstream, " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n");
- PRINTVALSTREAM(rawoutstream, " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -d (dataset) is used. B is an optional argument, defaults to NATIVE\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Q - is the sort index type. It can be \"creation_order\" or \"name\" (default)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Z - is the sort order type. It can be \"descending\" or \"ascending\" (default)\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "--------------- Examples ---------------\n");
PRINTVALSTREAM(rawoutstream, "\n");
@@ -366,14 +391,16 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " 2) Selecting a subset from dataset /foo in file quux.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n");
+ PRINTVALSTREAM(rawoutstream,
+ " h5dump -d /foo -s \"0,1\" -S \"1,1\" -c \"2,3\" -k \"2,2\" quux.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " 3) Saving dataset 'dset' in file quux.h5 to binary file 'out.bin'\n");
PRINTVALSTREAM(rawoutstream, " using a little-endian type\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /dset -b LE -o out.bin quux.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset\n");
+ PRINTVALSTREAM(rawoutstream,
+ " 4) Display two packed bits (bits 0-1 and bits 4-6) in the dataset /dset\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /dset -M 0,1,4,3 quux.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
@@ -385,17 +412,19 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f split splitfile\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 7) Dataset foo in multi files mf-s.h5, mf-b.h5, mf-r.h5, mf-g.h5, mf-l.h5 and mf-o.h5\n");
+ PRINTVALSTREAM(
+ rawoutstream,
+ " 7) Dataset foo in multi files mf-s.h5, mf-b.h5, mf-r.h5, mf-g.h5, mf-l.h5 and mf-o.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f multi mf\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " 8) Dataset foo in family files fam00000.h5 fam00001.h5 and fam00002.h5\n");
+ PRINTVALSTREAM(rawoutstream,
+ " 8) Dataset foo in family files fam00000.h5 fam00001.h5 and fam00002.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " h5dump -d /foo -f family fam%%05d.h5\n");
PRINTVALSTREAM(rawoutstream, "\n");
}
-
/*-------------------------------------------------------------------------
* Function: table_list_add
*
@@ -407,28 +436,30 @@ usage(const char *prog)
ssize_t
table_list_add(hid_t oid, unsigned long file_no)
{
- size_t idx; /* Index of table to use */
+ size_t idx; /* Index of table to use */
find_objs_t info;
/* Allocate space if necessary */
- if(table_list.nused == table_list.nalloc) {
- h5dump_table_items_t *tmp_ptr;
+ if (table_list.nused == table_list.nalloc) {
+ h5dump_table_items_t *tmp_ptr;
table_list.nalloc = MAX(1, table_list.nalloc * 2);
- if(NULL == (tmp_ptr = (h5dump_table_items_t *)HDrealloc(table_list.tables, table_list.nalloc * sizeof(table_list.tables[0]))))
+ if (NULL == (tmp_ptr = (h5dump_table_items_t *)HDrealloc(
+ table_list.tables, table_list.nalloc * sizeof(table_list.tables[0]))))
return -1;
table_list.tables = tmp_ptr;
} /* end if */
/* Append it */
- idx = table_list.nused++;
+ idx = table_list.nused++;
table_list.tables[idx].fileno = file_no;
- table_list.tables[idx].oid = oid;
- if(H5Iinc_ref(oid) < 0) {
+ table_list.tables[idx].oid = oid;
+ if (H5Iinc_ref(oid) < 0) {
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;
@@ -438,10 +469,9 @@ table_list_add(hid_t oid, unsigned long file_no)
dump_tables(&info);
#endif /* H5DUMP_DEBUG */
- return((ssize_t) idx);
+ return ((ssize_t)idx);
} /* end table_list_add() */
-
/*-------------------------------------------------------------------------
* Function: table_list_visited
*
@@ -453,19 +483,18 @@ table_list_add(hid_t oid, unsigned long file_no)
H5_ATTR_PURE ssize_t
table_list_visited(unsigned long file_no)
{
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
/* Look for table */
- for(u = 0; u < table_list.nused; u++)
+ for (u = 0; u < table_list.nused; u++)
/* Check for fileno value already in array */
- if(table_list.tables[u].fileno == file_no)
- return((ssize_t) u);
+ if (table_list.tables[u].fileno == file_no)
+ return ((ssize_t)u);
/* Didn't find table */
- return(-1);
+ return (-1);
} /* end table_list_visited() */
-
/*-------------------------------------------------------------------------
* Function: table_list_free
*
@@ -477,12 +506,12 @@ table_list_visited(unsigned long file_no)
static void
table_list_free(void)
{
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
/* Iterate over tables */
- for(u = 0; u < table_list.nused; u++) {
+ for (u = 0; u < table_list.nused; u++) {
/* Release object id */
- if(H5Idec_ref(table_list.tables[u].oid) < 0)
+ if (H5Idec_ref(table_list.tables[u].oid) < 0)
h5tools_setstatus(EXIT_FAILURE);
/* Free each table */
@@ -514,15 +543,15 @@ set_binary_form(const char *form)
{
int bform = -1;
- if (HDstrcmp(form,"NATIVE") == 0 || HDstrcmp(form,"MEMORY") == 0) {
+ if (HDstrcmp(form, "NATIVE") == 0 || HDstrcmp(form, "MEMORY") == 0) {
/* native form */
bform = 0;
}
- else if (HDstrcmp(form,"FILE") == 0) /* file type form */
+ else if (HDstrcmp(form, "FILE") == 0) /* file type form */
bform = 1;
- else if (HDstrcmp(form,"LE") == 0) /* convert to little endian */
+ else if (HDstrcmp(form, "LE") == 0) /* convert to little endian */
bform = 2;
- else if (HDstrcmp(form,"BE") == 0) /* convert to big endian */
+ else if (HDstrcmp(form, "BE") == 0) /* convert to big endian */
bform = 3;
return bform;
@@ -543,9 +572,9 @@ set_sort_by(const char *form)
{
H5_index_t idx_type = H5_INDEX_UNKNOWN;
- if (HDstrcmp(form,"name")==0) /* H5_INDEX_NAME */
+ if (HDstrcmp(form, "name") == 0) /* H5_INDEX_NAME */
idx_type = H5_INDEX_NAME;
- else if (HDstrcmp(form,"creation_order")==0) /* H5_INDEX_CRT_ORDER */
+ else if (HDstrcmp(form, "creation_order") == 0) /* H5_INDEX_CRT_ORDER */
idx_type = H5_INDEX_CRT_ORDER;
return idx_type;
@@ -566,9 +595,9 @@ set_sort_order(const char *form)
{
H5_iter_order_t iter_order = H5_ITER_UNKNOWN;
- if (HDstrcmp(form,"ascending")==0) /* H5_ITER_INC */
+ if (HDstrcmp(form, "ascending") == 0) /* H5_ITER_INC */
iter_order = H5_ITER_INC;
- else if (HDstrcmp(form,"descending")==0) /* H5_ITER_DEC */
+ else if (HDstrcmp(form, "descending") == 0) /* H5_ITER_DEC */
iter_order = H5_ITER_DEC;
return iter_order;
@@ -592,11 +621,11 @@ set_sort_order(const char *form)
static void
parse_hsize_list(const char *h_list, subset_d *d)
{
- hsize_t *p_list;
- const char *ptr;
- unsigned int size_count = 0;
- unsigned int i = 0;
- unsigned int last_digit = 0;
+ hsize_t * p_list;
+ const char * ptr;
+ unsigned int size_count = 0;
+ unsigned int i = 0;
+ unsigned int last_digit = 0;
if (!h_list || !*h_list || *h_list == ';')
return;
@@ -621,7 +650,7 @@ parse_hsize_list(const char *h_list, subset_d *d)
p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t));
for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
- if(HDisdigit(*ptr)) {
+ if (HDisdigit(*ptr)) {
/* we should have an integer now */
p_list[i++] = (hsize_t)HDstrtoull(ptr, NULL, 0);
@@ -630,7 +659,7 @@ parse_hsize_list(const char *h_list, subset_d *d)
ptr++;
}
d->data = p_list;
- d->len = size_count;
+ d->len = size_count;
}
/*-------------------------------------------------------------------------
@@ -646,7 +675,7 @@ static struct subset_t *
parse_subset_params(const char *dset)
{
struct subset_t *s = NULL;
- char *brace;
+ char * brace;
if (!dump_opts.disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) {
*brace++ = '\0';
@@ -701,11 +730,11 @@ parse_mask_list(const char *h_list)
int slength_value;
unsigned length_value;
unsigned long long temp_mask;
- const char *ptr = NULL;
+ const char * ptr = NULL;
/* sanity check */
- if(h_list) {
- HDmemset(packed_mask,0,sizeof(packed_mask));
+ if (h_list) {
+ HDmemset(packed_mask, 0, sizeof(packed_mask));
packed_bits_num = 0;
/* scan in pair of offset,length separated by commas. */
@@ -717,10 +746,10 @@ parse_mask_list(const char *h_list)
return FAIL;
}
soffset_value = HDatoi(ptr);
- offset_value = (unsigned)soffset_value;
+ offset_value = (unsigned)soffset_value;
if (soffset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) {
- error_msg("Packed Bit offset value(%d) must be between 0 and %u\n",
- soffset_value, (unsigned)(PACKED_BITS_SIZE_MAX - 1));
+ error_msg("Packed Bit offset value(%d) must be between 0 and %u\n", soffset_value,
+ (unsigned)(PACKED_BITS_SIZE_MAX - 1));
return FAIL;
}
@@ -746,7 +775,7 @@ parse_mask_list(const char *h_list)
length_value = (unsigned)slength_value;
if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX) {
error_msg("Packed Bit offset+length value(%u) too large. Max is %u\n",
- offset_value+length_value, (unsigned)PACKED_BITS_SIZE_MAX);
+ offset_value + length_value, (unsigned)PACKED_BITS_SIZE_MAX);
return FAIL;
}
@@ -766,8 +795,8 @@ parse_mask_list(const char *h_list)
/* After packed_mask is calculated, packed_length is not needed but */
/* keep it for debug purpose. */
temp_mask = ~0ULL;
- if(length_value < (int)(8 *sizeof(unsigned long long))) {
- temp_mask = temp_mask << length_value;
+ if (length_value < (int)(8 * sizeof(unsigned long long))) {
+ temp_mask = temp_mask << length_value;
packed_mask[packed_bits_num] = ~temp_mask;
}
else
@@ -783,7 +812,7 @@ parse_mask_list(const char *h_list)
}
}
}
- if(packed_bits_num > PACKED_BITS_MAX) {
+ if (packed_bits_num > PACKED_BITS_MAX) {
error_msg("Maximum number of packed bits exceeded\n");
return FAIL;
}
@@ -794,13 +823,12 @@ parse_mask_list(const char *h_list)
}
return SUCCEED;
}
- else {
+ else {
error_msg("Bad mask list argument\n");
return FAIL;
}
}
-
/*-------------------------------------------------------------------------
* Function: free_handler
*
@@ -816,25 +844,25 @@ free_handler(struct handler_t *hand, int len)
{
int i;
- if(hand) {
+ if (hand) {
for (i = 0; i < len; i++) {
- if(hand[i].obj) {
+ if (hand[i].obj) {
HDfree(hand[i].obj);
- hand[i].obj=NULL;
+ hand[i].obj = NULL;
}
if (hand[i].subset_info) {
- if(hand[i].subset_info->start.data)
+ if (hand[i].subset_info->start.data)
HDfree(hand[i].subset_info->start.data);
- if(hand[i].subset_info->stride.data)
+ if (hand[i].subset_info->stride.data)
HDfree(hand[i].subset_info->stride.data);
- if(hand[i].subset_info->count.data)
+ if (hand[i].subset_info->count.data)
HDfree(hand[i].subset_info->count.data);
- if(hand[i].subset_info->block.data)
+ if (hand[i].subset_info->block.data)
HDfree(hand[i].subset_info->block.data);
HDfree(hand[i].subset_info);
- hand[i].subset_info=NULL;
+ hand[i].subset_info = NULL;
}
}
@@ -842,7 +870,6 @@ free_handler(struct handler_t *hand, int len)
}
}
-
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -857,11 +884,11 @@ free_handler(struct handler_t *hand, int len)
static struct handler_t *
parse_command_line(int argc, const char *argv[])
{
- struct handler_t *hand = NULL;
- struct handler_t *last_dset = NULL;
- int i;
- int opt;
- int last_was_dset = FALSE;
+ struct handler_t *hand = NULL;
+ struct handler_t *last_dset = NULL;
+ int i;
+ int opt;
+ int last_was_dset = FALSE;
/* no arguments */
if (argc == 1) {
@@ -870,7 +897,7 @@ parse_command_line(int argc, const char *argv[])
}
/* this will be plenty big enough to hold the info */
- if((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t))) == NULL) {
+ if ((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t))) == NULL) {
goto error;
}
@@ -878,61 +905,60 @@ parse_command_line(int argc, const char *argv[])
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
parse_start:
switch ((char)opt) {
- case 'R':
- dump_opts.display_region = TRUE;
- region_output = TRUE;
- break;
- case 'B':
- dump_opts.display_bb = TRUE;
- last_was_dset = FALSE;
- break;
- case 'n':
- dump_opts.display_fi = TRUE;
- last_was_dset = FALSE;
- if (opt_arg != NULL)
- h5trav_set_verbose(HDatoi(opt_arg));
- break;
- case 'p':
- dump_opts.display_dcpl = TRUE;
- break;
- case 'y':
- dump_opts.display_ai = FALSE;
- break;
- case 'e':
- dump_opts.display_escape = TRUE;
- break;
- case 'H':
- dump_opts.display_data = FALSE;
- dump_opts.display_attr_data = FALSE;
- last_was_dset = FALSE;
- break;
- case 'A':
- if (opt_arg != NULL) {
- if(0 == HDatoi(opt_arg))
- dump_opts.include_attrs = FALSE;
- }
- else {
- dump_opts.display_data = FALSE;
- dump_opts.display_attr_data = TRUE;
- last_was_dset = FALSE;
- }
- break;
- case 'i':
- dump_opts.display_oid = TRUE;
- last_was_dset = FALSE;
- break;
- case 'r':
- dump_opts.display_char = TRUE;
- break;
- case 'V':
- print_version(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
- h5tools_setstatus(EXIT_SUCCESS);
- goto done;
- break;
- case 'w':
- {
+ case 'R':
+ dump_opts.display_region = TRUE;
+ region_output = TRUE;
+ break;
+ case 'B':
+ dump_opts.display_bb = TRUE;
+ last_was_dset = FALSE;
+ break;
+ case 'n':
+ dump_opts.display_fi = TRUE;
+ last_was_dset = FALSE;
+ if (opt_arg != NULL)
+ h5trav_set_verbose(HDatoi(opt_arg));
+ break;
+ case 'p':
+ dump_opts.display_dcpl = TRUE;
+ break;
+ case 'y':
+ dump_opts.display_ai = FALSE;
+ break;
+ case 'e':
+ dump_opts.display_escape = TRUE;
+ break;
+ case 'H':
+ dump_opts.display_data = FALSE;
+ dump_opts.display_attr_data = FALSE;
+ last_was_dset = FALSE;
+ break;
+ case 'A':
+ if (opt_arg != NULL) {
+ if (0 == HDatoi(opt_arg))
+ dump_opts.include_attrs = FALSE;
+ }
+ else {
+ dump_opts.display_data = FALSE;
+ dump_opts.display_attr_data = TRUE;
+ last_was_dset = FALSE;
+ }
+ break;
+ case 'i':
+ dump_opts.display_oid = TRUE;
+ last_was_dset = FALSE;
+ break;
+ case 'r':
+ dump_opts.display_char = TRUE;
+ break;
+ case 'V':
+ print_version(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ break;
+ case 'w': {
int sh5tools_nCols = HDatoi(opt_arg);
if (sh5tools_nCols <= 0)
@@ -940,356 +966,355 @@ parse_start:
else
h5tools_nCols = (unsigned)sh5tools_nCols;
last_was_dset = FALSE;
- }
- break;
- case 'N':
- dump_opts.display_all = 0;
-
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_paths;
- hand[i].obj = HDstrdup(opt_arg);
- break;
- }
-
- last_was_dset = FALSE;
- break;
- case 'a':
- dump_opts.display_all = 0;
+ } break;
+ case 'N':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_paths;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_attributes;
- hand[i].obj = HDstrdup(opt_arg);
- break;
- }
+ last_was_dset = FALSE;
+ break;
+ case 'a':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_attributes;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
- last_was_dset = FALSE;
- break;
- case 'd':
- dump_opts.display_all = 0;
-
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_datasets;
- hand[i].obj = HDstrdup(opt_arg);
- hand[i].subset_info = parse_subset_params(hand[i].obj);
- last_dset = &hand[i];
- break;
- }
+ last_was_dset = FALSE;
+ break;
+ case 'd':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_datasets;
+ hand[i].obj = HDstrdup(opt_arg);
+ hand[i].subset_info = parse_subset_params(hand[i].obj);
+ last_dset = &hand[i];
+ break;
+ }
- last_was_dset = TRUE;
- break;
- case 'f':
- driver_name_g = opt_arg;
- break;
- case 'g':
- dump_opts.display_all = 0;
-
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_groups;
- hand[i].obj = HDstrdup(opt_arg);
- break;
- }
+ last_was_dset = TRUE;
+ break;
+ case 'f':
+ driver_name_g = opt_arg;
+ break;
+ case 'g':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_groups;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
- last_was_dset = FALSE;
- break;
- case 'l':
- dump_opts.display_all = 0;
+ last_was_dset = FALSE;
+ break;
+ case 'l':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_links;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_links;
- hand[i].obj = HDstrdup(opt_arg);
- break;
- }
+ last_was_dset = FALSE;
+ break;
+ case 't':
+ dump_opts.display_all = 0;
+
+ for (i = 0; i < argc; i++)
+ if (!hand[i].func) {
+ hand[i].func = handle_datatypes;
+ hand[i].obj = HDstrdup(opt_arg);
+ break;
+ }
- last_was_dset = FALSE;
- break;
- case 't':
- dump_opts.display_all = 0;
+ last_was_dset = FALSE;
+ break;
- for (i = 0; i < argc; i++)
- if (!hand[i].func) {
- hand[i].func = handle_datatypes;
- hand[i].obj = HDstrdup(opt_arg);
- break;
+ case 'O':
+ if (h5tools_set_output_file(opt_arg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
}
+ break;
- last_was_dset = FALSE;
- break;
+ case 'o':
+ if (bin_output) {
+ if (h5tools_set_data_output_file(opt_arg, 1) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ else {
+ if (dump_opts.display_attr_data && !dump_opts.display_data) {
+ if (h5tools_set_attr_output_file(opt_arg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ if (dump_opts.display_data || dump_opts.display_all) {
+ if (h5tools_set_data_output_file(opt_arg, 0) < 0) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ }
+ }
- case 'O':
- if (h5tools_set_output_file(opt_arg, 0) < 0) {
- usage(h5tools_getprogname());
- goto error;
- }
- break;
+ dump_opts.usingdasho = TRUE;
+ last_was_dset = FALSE;
+ outfname_g = opt_arg;
+ break;
- case 'o':
- if (bin_output) {
- if (h5tools_set_data_output_file(opt_arg, 1) < 0) {
- usage(h5tools_getprogname());
- goto error;
- }
- }
- else {
- if(dump_opts.display_attr_data && !dump_opts.display_data) {
- if (h5tools_set_attr_output_file(opt_arg, 0) < 0) {
+ case 'b':
+ if (opt_arg != NULL) {
+ if ((bin_form = set_binary_form(opt_arg)) < 0) {
+ /* failed to set binary form */
usage(h5tools_getprogname());
goto error;
}
}
- if(dump_opts.display_data || dump_opts.display_all) {
- if (h5tools_set_data_output_file(opt_arg, 0) < 0) {
+ bin_output = TRUE;
+ if (outfname_g != NULL) {
+ if (h5tools_set_data_output_file(outfname_g, 1) < 0) {
+ /* failed to set output file */
usage(h5tools_getprogname());
goto error;
}
+
+ last_was_dset = FALSE;
}
- }
+ break;
+
+ case 'q':
+ if ((sort_by = set_sort_by(opt_arg)) < 0) {
+ /* failed to set "sort by" form */
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ break;
- dump_opts.usingdasho = TRUE;
- last_was_dset = FALSE;
- outfname_g = opt_arg;
- break;
+ case 'z':
+ if ((sort_order = set_sort_order(opt_arg)) < 0) {
+ /* failed to set "sort order" form */
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ break;
- case 'b':
- if (opt_arg != NULL) {
- if ((bin_form = set_binary_form(opt_arg)) < 0) {
- /* failed to set binary form */
+ case 'M':
+ if (!last_was_dset) {
+ error_msg("option `-%c' can only be used after --dataset option\n", opt);
+ goto error;
+ }
+ if (parse_mask_list(opt_arg) != SUCCEED) {
usage(h5tools_getprogname());
goto error;
}
- }
- bin_output = TRUE;
- if (outfname_g != NULL) {
- if (h5tools_set_data_output_file(outfname_g, 1) < 0) {
- /* failed to set output file */
+ dump_opts.display_packed_bits = TRUE;
+ break;
+ case 'v':
+ dump_opts.display_vds_first = TRUE;
+ break;
+ case 'G':
+ dump_opts.vds_gap_size = HDatoi(opt_arg);
+ if (dump_opts.vds_gap_size < 0) {
usage(h5tools_getprogname());
goto error;
}
+ break;
- last_was_dset = FALSE;
- }
- break;
+ /** begin XML parameters **/
+ case 'x':
+ /* select XML output */
+ doxml_g = TRUE;
+ useschema_g = TRUE;
+ h5tools_dump_header_format = NULL;
+ dump_function_table = &xml_function_table;
+ h5tools_nCols = 0;
+ break;
+ case 'u':
+ doxml_g = TRUE;
+ useschema_g = FALSE;
+ xmlnsprefix = "";
+ h5tools_dump_header_format = NULL;
+ dump_function_table = &xml_function_table;
+ h5tools_nCols = 0;
+ break;
+ case 'D':
+ /* specify alternative XML DTD or schema */
+ /* To Do: check format of this value? */
+ xml_dtd_uri_g = opt_arg;
+ h5tools_nCols = 0;
+ break;
- case 'q':
- if ((sort_by = set_sort_by(opt_arg)) < 0) {
- /* failed to set "sort by" form */
- usage(h5tools_getprogname());
- goto error;
- }
- break;
+ case 'm':
+ /* specify alternative floating point printing format */
+ fp_format = opt_arg;
+ h5tools_nCols = 0;
+ break;
- case 'z':
- if ((sort_order = set_sort_order(opt_arg)) < 0) {
- /* failed to set "sort order" form */
- usage(h5tools_getprogname());
- goto error;
- }
- break;
+ case 'X':
+ /* specify XML namespace (default="hdf5:"), or none */
+ /* To Do: check format of this value? */
+ if (!useschema_g) {
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ if (HDstrcmp(opt_arg, ":") == 0)
+ xmlnsprefix = "";
+ else
+ xmlnsprefix = opt_arg;
+ h5tools_nCols = 0;
+ break;
+ /** end XML parameters **/
- case 'M':
- if (!last_was_dset) {
- error_msg("option `-%c' can only be used after --dataset option\n", opt);
- goto error;
- }
- if (parse_mask_list(opt_arg) != SUCCEED){
- usage(h5tools_getprogname());
- goto error;
- }
- dump_opts.display_packed_bits = TRUE;
- break;
- case 'v':
- dump_opts.display_vds_first = TRUE;
- break;
- case 'G':
- dump_opts.vds_gap_size = HDatoi(opt_arg);
- if (dump_opts.vds_gap_size < 0) {
- usage(h5tools_getprogname());
- goto error;
- }
- break;
-
- /** begin XML parameters **/
- case 'x':
- /* select XML output */
- doxml_g = TRUE;
- useschema_g = TRUE;
- h5tools_dump_header_format = NULL;
- dump_function_table = &xml_function_table;
- h5tools_nCols = 0;
- break;
- case 'u':
- doxml_g = TRUE;
- useschema_g = FALSE;
- xmlnsprefix = "";
- h5tools_dump_header_format = NULL;
- dump_function_table = &xml_function_table;
- h5tools_nCols = 0;
- break;
- case 'D':
- /* specify alternative XML DTD or schema */
- /* To Do: check format of this value? */
- xml_dtd_uri_g = opt_arg;
- h5tools_nCols = 0;
- break;
-
- case 'm':
- /* specify alternative floating point printing format */
- fp_format = opt_arg;
- h5tools_nCols = 0;
- break;
-
- case 'X':
- /* specify XML namespace (default="hdf5:"), or none */
- /* To Do: check format of this value? */
- if (!useschema_g) {
- usage(h5tools_getprogname());
- goto error;
- }
- if (HDstrcmp(opt_arg,":") == 0)
- xmlnsprefix = "";
- else
- xmlnsprefix = opt_arg;
- h5tools_nCols = 0;
- break;
- /** end XML parameters **/
-
- /** begin subsetting parameters **/
- case 's':
- case 'S':
- case 'c':
- case 'k': {
- struct subset_t *s;
-
- if (!last_was_dset) {
- error_msg("option `-%c' can only be used after --dataset option\n", opt);
- goto error;
- }
+ /** begin subsetting parameters **/
+ case 's':
+ case 'S':
+ case 'c':
+ case 'k': {
+ struct subset_t *s;
+
+ if (!last_was_dset) {
+ error_msg("option `-%c' can only be used after --dataset option\n", opt);
+ goto error;
+ }
+
+ if (last_dset->subset_info) {
+ /*
+ * This overrides the "terse" syntax if they actually mixed
+ * the two.
+ */
+ s = last_dset->subset_info;
+ }
+ else {
+ last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
+ }
- if (last_dset->subset_info) {
/*
- * This overrides the "terse" syntax if they actually mixed
- * the two.
+ * slightly convoluted, but...we are only interested in options
+ * for subsetting: "--start", "--stride", "--count", and "--block"
+ * which can come in any order. If we run out of parameters (EOF)
+ * or run into one which isn't a subsetting parameter (NOT s, S,
+ * c, or K), then we exit the do-while look, set the subset_info
+ * to the structure we've been filling. If we've reached the end
+ * of the options, we exit the parsing (goto parse_end) otherwise,
+ * since we've "read" the next option, we need to parse it. So we
+ * jump to the beginning of the switch statement (goto parse_start).
*/
- s = last_dset->subset_info;
- }
- else {
- last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
- }
-
- /*
- * slightly convoluted, but...we are only interested in options
- * for subsetting: "--start", "--stride", "--count", and "--block"
- * which can come in any order. If we run out of parameters (EOF)
- * or run into one which isn't a subsetting parameter (NOT s, S,
- * c, or K), then we exit the do-while look, set the subset_info
- * to the structure we've been filling. If we've reached the end
- * of the options, we exit the parsing (goto parse_end) otherwise,
- * since we've "read" the next option, we need to parse it. So we
- * jump to the beginning of the switch statement (goto parse_start).
- */
- do {
- switch ((char)opt) {
- case 's':
- if (s->start.data) {
- HDfree(s->start.data);
- s->start.data = NULL;
- }
- parse_hsize_list(opt_arg, &s->start);
- break;
- case 'S':
- if (s->stride.data) {
- HDfree(s->stride.data);
- s->stride.data = NULL;
- }
- parse_hsize_list(opt_arg, &s->stride);
- break;
- case 'c':
- if (s->count.data) {
- HDfree(s->count.data);
- s->count.data = NULL;
- }
- parse_hsize_list(opt_arg, &s->count);
- break;
- case 'k':
- if (s->block.data) {
- HDfree(s->block.data);
- s->block.data = NULL;
+ do {
+ switch ((char)opt) {
+ case 's':
+ if (s->start.data) {
+ HDfree(s->start.data);
+ s->start.data = NULL;
+ }
+ parse_hsize_list(opt_arg, &s->start);
+ break;
+ case 'S':
+ if (s->stride.data) {
+ HDfree(s->stride.data);
+ s->stride.data = NULL;
+ }
+ parse_hsize_list(opt_arg, &s->stride);
+ break;
+ case 'c':
+ if (s->count.data) {
+ HDfree(s->count.data);
+ s->count.data = NULL;
+ }
+ parse_hsize_list(opt_arg, &s->count);
+ break;
+ case 'k':
+ if (s->block.data) {
+ HDfree(s->block.data);
+ s->block.data = NULL;
+ }
+ parse_hsize_list(opt_arg, &s->block);
+ break;
+ default:
+ goto end_collect;
}
- parse_hsize_list(opt_arg, &s->block);
- break;
- default:
- goto end_collect;
- }
- } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF);
+ } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF);
end_collect:
- last_was_dset = FALSE;
-
- if (opt != EOF)
- goto parse_start;
- else
- goto parse_end;
- }
- /** end subsetting parameters **/
+ last_was_dset = FALSE;
- case 'E':
- if (opt_arg != NULL)
- enable_error_stack = HDatoi(opt_arg);
- else
- enable_error_stack = 1;
- break;
- case 'C':
- dump_opts.disable_compact_subset = TRUE;
- break;
- case 'h':
- usage(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
- h5tools_setstatus(EXIT_SUCCESS);
- goto done;
+ if (opt != EOF)
+ goto parse_start;
+ else
+ goto parse_end;
+ }
+ /** end subsetting parameters **/
- case '$':
-#ifdef H5_HAVE_ROS3_VFD
- if (h5tools_parse_ros3_fapl_tuple(opt_arg, ',', &ros3_fa_g) < 0) {
- error_msg("failed to parse S3 VFD credential info\n");
+ case 'E':
+ if (opt_arg != NULL)
+ enable_error_stack = HDatoi(opt_arg);
+ else
+ enable_error_stack = 1;
+ break;
+ case 'C':
+ dump_opts.disable_compact_subset = TRUE;
+ break;
+ case 'h':
usage(h5tools_getprogname());
free_handler(hand, argc);
hand = NULL;
- h5tools_setstatus(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_SUCCESS);
goto done;
- }
+
+ case '$':
+#ifdef H5_HAVE_ROS3_VFD
+ if (h5tools_parse_ros3_fapl_tuple(opt_arg, ',', &ros3_fa_g) < 0) {
+ error_msg("failed to parse S3 VFD credential info\n");
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
#else
- error_msg("Read-Only S3 VFD not enabled.\n");
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
+ error_msg("Read-Only S3 VFD not enabled.\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
#endif
- break;
+ break;
- case '#':
+ case '#':
#ifdef H5_HAVE_LIBHDFS
- if (h5tools_parse_hdfs_fapl_tuple(opt_arg, ',', &hdfs_fa_g) < 0) {
- error_msg("failed to parse HDFS VFD configuration info\n");
- usage(h5tools_getprogname());
- free_handler(hand, argc);
- hand = NULL;
+ if (h5tools_parse_hdfs_fapl_tuple(opt_arg, ',', &hdfs_fa_g) < 0) {
+ error_msg("failed to parse HDFS VFD configuration info\n");
+ usage(h5tools_getprogname());
+ free_handler(hand, argc);
+ hand = NULL;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+#else
+ error_msg("HDFS VFD not enabled.\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
-#else
- error_msg("HDFS VFD not enabled.\n");
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
#endif
- break;
+ break;
- case '?':
- default:
- usage(h5tools_getprogname());
- goto error;
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ goto error;
}
}
@@ -1313,7 +1338,6 @@ error:
return hand;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1326,25 +1350,25 @@ error:
int
main(int argc, const char *argv[])
{
- hid_t fid = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t fapl_id = H5P_DEFAULT;
- H5O_info_t oi;
- struct handler_t *hand = NULL;
- int i;
- unsigned u;
- char *fname = NULL;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t fapl_id = H5P_DEFAULT;
+ H5O_info_t oi;
+ struct handler_t *hand = NULL;
+ int i;
+ unsigned u;
+ char * fname = NULL;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
h5tools_dump_header_format = &h5tools_standardformat;
- dump_function_table = &ddl_function_table;
- dump_indent = 0;
+ dump_function_table = &ddl_function_table;
+ dump_indent = 0;
/* Initialize h5tools lib */
h5tools_init();
- if((hand = parse_command_line(argc, argv))==NULL) {
+ if ((hand = parse_command_line(argc, argv)) == NULL) {
goto done;
}
@@ -1404,8 +1428,8 @@ main(int argc, const char *argv[])
if (driver_name_g != NULL) {
h5tools_vfd_info_t vfd_info;
- vfd_info.info = NULL;
- vfd_info.name = driver_name_g;
+ vfd_info.info = NULL;
+ vfd_info.name = driver_name_g;
if (!HDstrcmp(driver_name_g, drivernames[ROS3_VFD_IDX])) {
#ifdef H5_HAVE_ROS3_VFD
@@ -1433,11 +1457,10 @@ main(int argc, const char *argv[])
}
} /* driver name defined */
- while(opt_ind < argc) {
+ while (opt_ind < argc) {
fname = HDstrdup(argv[opt_ind++]);
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id,
- (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0);
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0);
if (fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
@@ -1451,7 +1474,7 @@ main(int argc, const char *argv[])
/* Prepare to find objects that might be targets of a reference */
fill_ref_path_table(fid);
- if(doxml_g) {
+ if (doxml_g) {
/* initialize XML */
/* reset prefix! */
HDstrcpy(prefix, "");
@@ -1463,12 +1486,13 @@ main(int argc, const char *argv[])
}
else {
xml_dtd_uri_g = DEFAULT_DTD;
- xmlnsprefix = "";
+ xmlnsprefix = "";
}
}
else {
- if (useschema_g && HDstrcmp(xmlnsprefix,"")) {
- error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
+ if (useschema_g && HDstrcmp(xmlnsprefix, "")) {
+ error_msg(
+ "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
@@ -1476,21 +1500,21 @@ main(int argc, const char *argv[])
}
/* Get object info for root group */
- if(H5Oget_info_by_name2(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name2(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* Initialize object tables */
- if(table_list_add(fid, oi.fileno) < 0) {
+ if (table_list_add(fid, oi.fileno) < 0) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
group_table = table_list.tables[0].group_table;
- dset_table = table_list.tables[0].dset_table;
- type_table = table_list.tables[0].type_table;
+ dset_table = table_list.tables[0].dset_table;
+ type_table = table_list.tables[0].type_table;
/* does there exist unamed committed datatype */
for (u = 0; u < type_table->nobjs; u++)
@@ -1501,35 +1525,42 @@ main(int argc, const char *argv[])
/* start to dump - display file header information */
if (!doxml_g) {
- begin_obj(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin);
+ begin_obj(h5tools_dump_header_format->filebegin, fname,
+ h5tools_dump_header_format->fileblockbegin);
}
else {
PRINTVALSTREAM(rawoutstream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
/* alternative first element, depending on schema or DTD. */
if (useschema_g) {
- if (HDstrcmp(xmlnsprefix,"") == 0) {
- PRINTSTREAM(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n", xml_dtd_uri_g);
+ if (HDstrcmp(xmlnsprefix, "") == 0) {
+ PRINTSTREAM(rawoutstream,
+ "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xsi:noNamespaceSchemaLocation=\"%s\">\n",
+ xml_dtd_uri_g);
}
else {
/* TO DO: make -url option work in this case (may need new option) */
char *ns;
char *indx;
- ns = HDstrdup(xmlnsprefix);
- indx = HDstrrchr(ns,(int)':');
+ ns = HDstrdup(xmlnsprefix);
+ indx = HDstrrchr(ns, (int)':');
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\" "
- "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File "
- "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",xmlnsprefix,ns);
+ PRINTSTREAM(rawoutstream,
+ "<%sHDF5-File xmlns:%s=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\" "
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File "
+ "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",
+ xmlnsprefix, ns);
HDfree(ns);
}
}
else {
- PRINTSTREAM(rawoutstream, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n", xml_dtd_uri_g);
+ PRINTSTREAM(rawoutstream, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n",
+ xml_dtd_uri_g);
PRINTVALSTREAM(rawoutstream, "<HDF5-File>\n");
}
}
@@ -1538,7 +1569,7 @@ main(int argc, const char *argv[])
if (dump_opts.display_fi) {
PRINTVALSTREAM(rawoutstream, "\n");
dump_fcontents(fid);
- end_obj(h5tools_dump_header_format->fileend,h5tools_dump_header_format->fileblockend);
+ end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend);
PRINTVALSTREAM(rawoutstream, "\n");
goto done;
}
@@ -1547,36 +1578,35 @@ main(int argc, const char *argv[])
dump_fcpl(fid);
}
- if(dump_opts.display_all) {
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
+ if (dump_opts.display_all) {
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
error_msg("unable to open root group\n");
h5tools_setstatus(EXIT_FAILURE);
}
else {
if (!doxml_g)
dump_indent += COL;
- dump_function_table->dump_group_function(gid, "/" );
+ dump_function_table->dump_group_function(gid, "/");
if (!doxml_g)
dump_indent -= COL;
PRINTVALSTREAM(rawoutstream, "\n");
}
- if(H5Gclose(gid) < 0) {
+ if (H5Gclose(gid) < 0) {
error_msg("unable to close root group\n");
h5tools_setstatus(EXIT_FAILURE);
}
-
}
else {
/* Note: this option is not supported for XML */
- if(doxml_g) {
+ if (doxml_g) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
} /* end if */
- for(i = 0; i < argc; i++) {
- if(hand[i].func) {
+ for (i = 0; i < argc; i++) {
+ if (hand[i].func) {
hand[i].func(fid, hand[i].obj, hand[i].subset_info, 1, NULL);
}
}
@@ -1593,21 +1623,21 @@ main(int argc, const char *argv[])
/* Free tables for objects */
table_list_free();
- if(fid >=0)
+ if (fid >= 0)
if (H5Fclose(fid) < 0)
h5tools_setstatus(EXIT_FAILURE);
- if(prefix) {
+ if (prefix) {
HDfree(prefix);
prefix = NULL;
}
- if(fname) {
+ if (fname) {
HDfree(fname);
fname = NULL;
}
} /* end while */
- if(hand)
+ if (hand)
free_handler(hand, argc);
/* To Do: clean up XML table */
@@ -1623,20 +1653,20 @@ done:
h5tools_setstatus(EXIT_FAILURE);
}
- if(fid >=0)
+ if (fid >= 0)
if (H5Fclose(fid) < 0)
h5tools_setstatus(EXIT_FAILURE);
- if(prefix) {
+ if (prefix) {
HDfree(prefix);
prefix = NULL;
}
- if(fname) {
+ if (fname) {
HDfree(fname);
fname = NULL;
}
- if(hand)
+ if (hand)
free_handler(hand, argc);
/* To Do: clean up XML table */
@@ -1644,7 +1674,6 @@ done:
leave(h5tools_getstatus());
} /* main */
-
/*-------------------------------------------------------------------------
* Function: init_prefix
*
@@ -1659,13 +1688,12 @@ done:
static void
init_prefix(char **prfx, size_t prfx_len)
{
- if(prfx_len > 0)
+ if (prfx_len > 0)
*prfx = (char *)HDcalloc(prfx_len, 1);
else
error_msg("unable to allocate prefix buffer\n");
}
-
/*-------------------------------------------------------------------------
* Function: add_prefix
*
@@ -1681,12 +1709,11 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name)
size_t new_len = HDstrlen(*prfx) + HDstrlen(name) + 2;
/* Check if we need more space */
- if(*prfx_len <= new_len) {
+ if (*prfx_len <= new_len) {
*prfx_len = new_len + 1;
- *prfx = (char *)HDrealloc(*prfx, *prfx_len);
+ *prfx = (char *)HDrealloc(*prfx, *prfx_len);
}
/* Append object name to prefix */
HDstrcat(HDstrcat(*prfx, "/"), name);
} /* end add_prefix */
-
diff --git a/tools/src/h5dump/h5dump.h b/tools/src/h5dump/h5dump.h
index 548af09..b4198ad 100644
--- a/tools/src/h5dump/h5dump.h
+++ b/tools/src/h5dump/h5dump.h
@@ -26,66 +26,67 @@
**/
/* the table of dump functions */
typedef struct dump_functions_t {
- void (*dump_group_function) (hid_t, const char *);
- void (*dump_named_datatype_function) (hid_t, const char *);
- void (*dump_dataset_function) (hid_t, const char *, struct subset_t *);
- void (*dump_dataspace_function) (hid_t);
- void (*dump_datatype_function) (hid_t);
- herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *);
- void (*dump_data_function) (hid_t, int, struct subset_t *, int);
+ void (*dump_group_function)(hid_t, const char *);
+ void (*dump_named_datatype_function)(hid_t, const char *);
+ void (*dump_dataset_function)(hid_t, const char *, struct subset_t *);
+ void (*dump_dataspace_function)(hid_t);
+ void (*dump_datatype_function)(hid_t);
+ herr_t (*dump_attribute_function)(hid_t, const char *, const H5A_info_t *, void *);
+ void (*dump_data_function)(hid_t, int, struct subset_t *, int);
} dump_functions;
/* List of table structures. There is one table structure for each file */
typedef struct h5dump_table_items_t {
- unsigned long fileno; /* File number that these tables refer to */
- hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
- table_t *group_table; /* Table of groups */
- table_t *dset_table; /* Table of datasets */
- table_t *type_table; /* Table of datatypes */
+ unsigned long fileno; /* File number that these tables refer to */
+ hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
+ table_t * group_table; /* Table of groups */
+ table_t * dset_table; /* Table of datasets */
+ table_t * type_table; /* Table of datatypes */
} h5dump_table_items_t;
typedef struct h5dump_table_list_t {
- size_t nalloc;
- size_t nused;
- h5dump_table_items_t *tables;
+ size_t nalloc;
+ size_t nused;
+ h5dump_table_items_t *tables;
} h5dump_table_list_t;
-h5dump_table_list_t table_list = {0, 0, NULL};
-table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL;
+h5dump_table_list_t table_list = {0, 0, NULL};
+table_t * group_table = NULL, *dset_table = NULL, *type_table = NULL;
-unsigned dump_indent = 0; /* how far in to indent the line */
-int unamedtype = 0; /* shared datatype with no name */
-hbool_t hit_elink = FALSE; /* whether we have traversed an external link */
-size_t prefix_len = 1024;
-char *prefix = NULL;
-const char *fp_format = NULL;
+unsigned dump_indent = 0; /* how far in to indent the line */
+int unamedtype = 0; /* shared datatype with no name */
+hbool_t hit_elink = FALSE; /* whether we have traversed an external link */
+size_t prefix_len = 1024;
+char * prefix = NULL;
+const char *fp_format = NULL;
/* things to display or which are set via command line parameters */
typedef struct {
- int display_all;
- int display_oid;
- int display_data;
- int display_attr_data;
- int display_char; /* print 1-byte numbers as ASCII */
- int usingdasho;
- int display_bb; /* superblock */
- int display_dcpl; /* dcpl */
- int display_fi; /* file index */
- int display_ai; /* array index */
- int display_escape; /* escape non printable characters */
- int display_region; /* print region reference data */
- int disable_compact_subset; /* disable compact form of subset notation */
- int display_packed_bits; /* print 1-8 byte numbers as packed bits */
- int include_attrs; /* Display attributes */
- int display_vds_first; /* vds display to all by default */
- int vds_gap_size; /* vds skip missing files default is none */
+ int display_all;
+ int display_oid;
+ int display_data;
+ int display_attr_data;
+ int display_char; /* print 1-byte numbers as ASCII */
+ int usingdasho;
+ int display_bb; /* superblock */
+ int display_dcpl; /* dcpl */
+ int display_fi; /* file index */
+ int display_ai; /* array index */
+ int display_escape; /* escape non printable characters */
+ int display_region; /* print region reference data */
+ int disable_compact_subset; /* disable compact form of subset notation */
+ int display_packed_bits; /* print 1-8 byte numbers as packed bits */
+ int include_attrs; /* Display attributes */
+ int display_vds_first; /* vds display to all by default */
+ int vds_gap_size; /* vds skip missing files default is none */
} dump_opt_t;
-dump_opt_t dump_opts = {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0};
+dump_opt_t dump_opts = {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE,
+ TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0};
-#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
-#define PACKED_BITS_SIZE_MAX (8*sizeof(long long)) /* Maximum bits size of integer types of packed-bits */
+#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
+#define PACKED_BITS_SIZE_MAX (8 * sizeof(long long)) /* Maximum bits size of integer types of packed-bits */
/* mask list for packed bits */
-unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
+unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
/* packed bits display parameters */
unsigned packed_offset[PACKED_BITS_MAX];
@@ -98,16 +99,17 @@ unsigned packed_length[PACKED_BITS_MAX];
const dump_functions *dump_function_table;
#ifdef __cplusplus
-"C" {
+"C"
+{
#endif
-void add_prefix(char **prfx, size_t *prfx_len, const char *name);
-hid_t h5_fileaccess(void);
-ssize_t table_list_add(hid_t oid, unsigned long file_no);
-ssize_t table_list_visited(unsigned long file_no);
+ void add_prefix(char **prfx, size_t *prfx_len, const char *name);
+ hid_t h5_fileaccess(void);
+ ssize_t table_list_add(hid_t oid, unsigned long file_no);
+ ssize_t table_list_visited(unsigned long file_no);
#ifdef __cplusplus
}
#endif
-#endif /* !H5DUMP_H__ */
+#endif /* !H5DUMP_H__ */
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index c752fbb..c7037c8 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -21,18 +21,18 @@
#include "h5dump_ddl.h"
typedef struct {
- hid_t fid; /* File ID being traversed */
- const char *op_name; /* Object name wanted */
+ hid_t fid; /* File ID being traversed */
+ const char *op_name; /* Object name wanted */
} trav_handle_udata_t;
typedef struct {
- const char *path; /* Path of object being searched */
- const char *op_name; /* Object name wanted */
+ const char *path; /* Path of object being searched */
+ const char *op_name; /* Object name wanted */
} trav_attr_udata_t;
/* callback function used by H5Literate() */
-static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data);
-static int dump_extlink(hid_t group, const char *linkname, const char *objname);
+static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data);
+static int dump_extlink(hid_t group, const char *linkname, const char *objname);
/*-------------------------------------------------------------------------
* Function: dump_datatype
@@ -46,12 +46,12 @@ static int dump_extlink(hid_t group, const char *linkname, const char *objn
void
dump_datatype(hid_t type)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
h5dump_type_table = type_table;
h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type);
@@ -70,17 +70,16 @@ dump_datatype(hid_t type)
void
dump_dataspace(hid_t space)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space);
}
-
/*-------------------------------------------------------------------------
* Function: dump_attr_cb
*
@@ -91,48 +90,49 @@ dump_dataspace(hid_t space)
*-------------------------------------------------------------------------
*/
herr_t
-dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
+dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info,
+ void H5_ATTR_UNUSED *_op_data)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hid_t attr_id;
- herr_t ret = SUCCEED;
+ hid_t attr_id;
+ herr_t ret = SUCCEED;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
ctx.display_index = dump_opts.display_ai;
- ctx.display_char = dump_opts.display_char;
+ ctx.display_char = dump_opts.display_char;
- attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
- oid_output = dump_opts.display_oid;
- data_output = dump_opts.display_data;
+ attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
+ oid_output = dump_opts.display_oid;
+ data_output = dump_opts.display_data;
attr_data_output = dump_opts.display_attr_data;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
h5dump_type_table = type_table;
h5tools_dump_attribute(rawoutstream, outputformat, &ctx, attr_name, attr_id);
h5dump_type_table = NULL;
- if(attr_id < 0) {
+ if (attr_id < 0) {
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
@@ -140,7 +140,6 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
return ret;
}
-
/*-------------------------------------------------------------------------
* Function: dump_all_cb
*
@@ -154,43 +153,43 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
static herr_t
dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
{
- hid_t obj;
- hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
- herr_t ret = SUCCEED;
- char *obj_path = NULL; /* Full path of object */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ hid_t obj;
+ hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
+ herr_t ret = SUCCEED;
+ char * obj_path = NULL; /* Full path of object */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
/* Build the object's path name */
obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
- if(!obj_path) {
+ if (!obj_path) {
ret = FAIL;
goto done;
}
@@ -199,354 +198,368 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
HDstrcat(obj_path, "/");
HDstrcat(obj_path, name);
- if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ if (linfo->type == H5L_TYPE_HARD) {
+ H5O_info_t oinfo;
/* Stat the object */
- if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("unable to get object information for \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
goto done;
} /* end if */
- switch(oinfo.type) {
- case H5O_TYPE_GROUP:
- if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
- error_msg("unable to dump group \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- char *old_prefix; /* Pointer to previous prefix */
+ switch (oinfo.type) {
+ case H5O_TYPE_GROUP:
+ if ((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump group \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ char *old_prefix; /* Pointer to previous prefix */
- /* Keep copy of prefix before iterating into group */
- old_prefix = HDstrdup(prefix);
- if (old_prefix) {
- /* Append group name to prefix */
- add_prefix(&prefix, &prefix_len, name);
+ /* Keep copy of prefix before iterating into group */
+ old_prefix = HDstrdup(prefix);
+ if (old_prefix) {
+ /* Append group name to prefix */
+ add_prefix(&prefix, &prefix_len, name);
- /* Iterate into group */
- dump_function_table->dump_group_function(obj, name);
+ /* Iterate into group */
+ dump_function_table->dump_group_function(obj, name);
- /* Restore old prefix name */
- HDstrcpy(prefix, old_prefix);
- HDfree(old_prefix);
- }
- else
- error_msg("warning: null prefix\n");
+ /* Restore old prefix name */
+ HDstrcpy(prefix, old_prefix);
+ HDfree(old_prefix);
+ }
+ else
+ error_msg("warning: null prefix\n");
- /* Close group */
- H5Gclose(obj);
- }
- break;
+ /* Close group */
+ H5Gclose(obj);
+ }
+ break;
- case H5O_TYPE_DATASET:
- if(dump_opts.display_data) {
- if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
- error_msg("error in creating default access property list ID\n");
+ case H5O_TYPE_DATASET:
+ if (dump_opts.display_data) {
+ if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
+ error_msg("error in creating default access property list ID\n");
+ }
+ if (dump_opts.display_vds_first) {
+ if (H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
+ error_msg("error in setting access property list ID, virtual_view\n");
+ }
+ if (dump_opts.vds_gap_size > 0) {
+ if (H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
+ error_msg("error in setting access property list ID, virtual_printf_gap\n");
+ }
}
- if (dump_opts.display_vds_first) {
- if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
- error_msg("error in setting access property list ID, virtual_view\n");
+ if ((obj = H5Dopen2(group, name, dapl_id)) >= 0) {
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
+
+ found_obj = search_obj(dset_table, oinfo.addr);
+
+ if (found_obj == NULL) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ h5tools_str_append(&buffer, "%s",
+ h5tools_dump_header_format->datasetblockend);
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ H5Dclose(obj);
+ goto done;
+ }
+ else if (found_obj->displayed) {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ h5tools_str_append(&buffer, "%s",
+ h5tools_dump_header_format->datasetblockend);
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ H5Dclose(obj);
+ goto done;
+ }
+ else {
+ found_obj->displayed = TRUE;
+ }
+ } /* end if */
+
+ dump_function_table->dump_dataset_function(obj, name, NULL);
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ H5Dclose(obj);
}
- if (dump_opts.vds_gap_size > 0) {
- if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
- error_msg("error in setting access property list ID, virtual_printf_gap\n");
+ else {
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
+ error_msg("unable to dump dataset \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
}
- }
- if((obj = H5Dopen2(group, name, dapl_id)) >= 0) {
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
-
- found_obj = search_obj(dset_table, oinfo.addr);
-
- if(found_obj == NULL) {
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->datasetbegin, name,
- h5tools_dump_header_format->datasetblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ case H5O_TYPE_NAMED_DATATYPE:
+ if ((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump datatype \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ dump_function_table->dump_named_datatype_function(obj, name);
+ H5Tclose(obj);
+ }
+ break;
- error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ error_msg("unknown object \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ } /* end if */
+ else {
+ char *targbuf;
- ctx.need_prefix = TRUE;
+ switch (linfo->type) {
+ case H5L_TYPE_SOFT:
+ if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, " ");
- }
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->softlinkbegin,
+ name, h5tools_dump_header_format->softlinkblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
+ ctx.indent_level++;
+ if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get link value\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- if (dapl_id != H5P_DEFAULT)
- H5Pclose(dapl_id);
- H5Dclose(obj);
- goto done;
}
- else if(found_obj->displayed) {
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->datasetbegin, name,
- h5tools_dump_header_format->datasetblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level--;
-
+ else {
+ /* print the value of a soft link */
+ /* Standard DDL: no modification */
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, " ");
- }
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- if (dapl_id != H5P_DEFAULT)
- H5Pclose(dapl_id);
- H5Dclose(obj);
- goto done;
+ h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
- else {
- found_obj->displayed = TRUE;
- }
- } /* end if */
- dump_function_table->dump_dataset_function(obj, name, NULL);
- if (dapl_id != H5P_DEFAULT)
- H5Pclose(dapl_id);
- H5Dclose(obj);
- }
- else {
- if (dapl_id != H5P_DEFAULT)
- H5Pclose(dapl_id);
- error_msg("unable to dump dataset \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- break;
-
- case H5O_TYPE_NAMED_DATATYPE:
- if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
- error_msg("unable to dump datatype \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- dump_function_table->dump_named_datatype_function(obj, name);
- H5Tclose(obj);
- }
- break;
+ ctx.indent_level--;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- error_msg("unknown object \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- } /* end if */
- else {
- char *targbuf;
-
- switch(linfo->type) {
- case H5L_TYPE_SOFT:
- if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
- error_msg("unable to allocate buffer\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->softlinkbegin, name,
- h5tools_dump_header_format->softlinkblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->softlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkblockend);
+ if (HDstrlen(h5tools_dump_header_format->softlinkend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->softlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
+ HDfree(targbuf);
+ }
+ break;
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg("unable to get link value\n");
+ case H5L_TYPE_EXTERNAL:
+ if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- /* print the value of a soft link */
- /* Standard DDL: no modification */
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "LINKTARGET \"%s\"", targbuf);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->extlinkbegin,
+ name, h5tools_dump_header_format->extlinkblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
+ if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ indentation(dump_indent);
+ error_msg("unable to get external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ const char *filename;
+ const char *targname;
+
+ if (H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
+ indentation(dump_indent);
+ error_msg("unable to unpack external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "TARGETPATH \"%s\"", targname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* dump the external link */
+ dump_extlink(group, name, targname);
+ ctx.indent_level--;
+ } /* end else */
+ } /* end else */
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->extlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkblockend);
+ if (HDstrlen(h5tools_dump_header_format->extlinkend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->extlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->softlinkblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkblockend);
- if(HDstrlen(h5tools_dump_header_format->softlinkend))
- h5tools_str_append(&buffer, " ");
+ HDfree(targbuf);
}
- if(HDstrlen(h5tools_dump_header_format->softlinkend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->softlinkend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- HDfree(targbuf);
- }
- break;
+ break;
- case H5L_TYPE_EXTERNAL:
- if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
- error_msg("unable to allocate buffer\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->extlinkbegin, name,
- h5tools_dump_header_format->extlinkblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- indentation(dump_indent);
- error_msg("unable to get external link value\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- } /* end if */
- else {
- const char *filename;
- const char *targname;
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->udlinkbegin, name,
+ h5tools_dump_header_format->udlinkblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
- indentation(dump_indent);
- error_msg("unable to unpack external link value\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- } /* end if */
- else {
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
+ ctx.indent_level++;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "TARGETFILE \"%s\"", filename);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "LINKCLASS %d", linfo->type);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.indent_level--;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "TARGETPATH \"%s\"", targname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- /* dump the external link */
- dump_extlink(group, name, targname);
- ctx.indent_level--;
- } /* end else */
- } /* end else */
ctx.need_prefix = TRUE;
-
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->extlinkblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkblockend);
- if(HDstrlen(h5tools_dump_header_format->extlinkend))
+ if (HDstrlen(h5tools_dump_header_format->udlinkblockend)) {
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkblockend);
+ if (HDstrlen(h5tools_dump_header_format->udlinkend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->extlinkend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->extlinkend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- HDfree(targbuf);
- }
- break;
-
- case H5L_TYPE_ERROR:
- case H5L_TYPE_MAX:
- case H5L_TYPE_HARD:
- default:
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->udlinkbegin, name,
- h5tools_dump_header_format->udlinkblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "LINKCLASS %d", linfo->type);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level--;
-
- ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->udlinkblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkblockend);
- if(HDstrlen(h5tools_dump_header_format->udlinkend))
- h5tools_str_append(&buffer, " ");
- }
- if(HDstrlen(h5tools_dump_header_format->udlinkend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (HDstrlen(h5tools_dump_header_format->udlinkend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->udlinkend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ break;
} /* end switch */
- } /* end else */
+ } /* end else */
done:
h5tools_str_close(&buffer);
- if(obj_path)
+ if (obj_path)
HDfree(obj_path);
return ret;
}
@@ -564,19 +577,19 @@ attr_iteration(hid_t gid, unsigned attr_crt_order_flags)
{
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group for attributes, then, sort by creation order, otherwise by name */
- if(dump_opts.include_attrs) {
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
- if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ if (dump_opts.include_attrs) {
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if (H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ if (H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end else */
+ } /* end else */
}
}
@@ -594,7 +607,7 @@ link_iteration(hid_t gid, unsigned crt_order_flags)
/* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group, then, sort by creation order, otherwise by name */
- if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL);
else
H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL);
@@ -613,11 +626,11 @@ dump_named_datatype(hid_t tid, const char *name)
{
H5O_info_t oinfo;
unsigned attr_crt_order_flags;
- hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
- 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 = &h5tools_dataformat;
+ hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
+ 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 = &h5tools_dataformat;
h5tool_format_t string_dataformat;
/* setup */
@@ -625,24 +638,24 @@ dump_named_datatype(hid_t tid, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
if ((tcpl_id = H5Tget_create_plist(tid)) < 0) {
error_msg("error in getting creation property list ID\n");
@@ -655,7 +668,7 @@ dump_named_datatype(hid_t tid, const char *name)
h5tools_setstatus(EXIT_FAILURE);
}
- if(H5Pclose(tcpl_id) < 0) {
+ if (H5Pclose(tcpl_id) < 0) {
error_msg("error in closing creation property list ID\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -664,18 +677,18 @@ dump_named_datatype(hid_t tid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->datatypebegin, name,
- h5tools_dump_header_format->datatypeblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datatypebegin, name,
+ h5tools_dump_header_format->datatypeblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC);
/* Must check for uniqueness of all objects if we've traversed an elink,
* otherwise only check if the reference count > 1.
*/
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
found_obj = search_obj(type_table, oinfo.addr);
@@ -688,7 +701,8 @@ dump_named_datatype(hid_t tid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
goto done;
}
else
@@ -699,11 +713,12 @@ dump_named_datatype(hid_t tid, const char *name)
h5tools_str_reset(&buffer);
h5tools_print_datatype(rawoutstream, &buffer, outputformat, &ctx, tid, FALSE);
- if(H5Tget_class(tid) != H5T_COMPOUND) {
+ if (H5Tget_class(tid) != H5T_COMPOUND) {
h5tools_str_append(&buffer, ";");
}
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* print attributes */
dump_indent += COL;
@@ -715,14 +730,15 @@ dump_named_datatype(hid_t tid, const char *name)
done:
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datatypeblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->datatypeblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeblockend);
- if(HDstrlen(h5tools_dump_header_format->datatypeend))
+ if (HDstrlen(h5tools_dump_header_format->datatypeend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->datatypeend))
+ if (HDstrlen(h5tools_dump_header_format->datatypeend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datatypeend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -738,18 +754,18 @@ done:
void
dump_group(hid_t gid, const char *name)
{
- H5O_info_t oinfo;
- hid_t dset;
- hid_t type;
- hid_t gcpl_id;
- unsigned crt_order_flags;
- unsigned attr_crt_order_flags;
- char type_name[1024];
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ H5O_info_t oinfo;
+ hid_t dset;
+ hid_t type;
+ hid_t gcpl_id;
+ unsigned crt_order_flags;
+ unsigned attr_crt_order_flags;
+ char type_name[1024];
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
error_msg("error in getting group creation property list ID\n");
@@ -763,12 +779,12 @@ dump_group(hid_t gid, const char *name)
}
/* query the group creation properties */
- if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
+ if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
error_msg("error in getting group creation properties\n");
h5tools_setstatus(EXIT_FAILURE);
}
- if(H5Pclose(gcpl_id) < 0) {
+ if (H5Pclose(gcpl_id) < 0) {
error_msg("error in closing group creation property list ID\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -778,53 +794,53 @@ dump_group(hid_t gid, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->groupbegin, name,
- h5tools_dump_header_format->groupblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->groupbegin, name,
+ h5tools_dump_header_format->groupblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
- if(!HDstrcmp(name, "/") && unamedtype) {
- unsigned u; /* Local index variable */
+ if (!HDstrcmp(name, "/") && unamedtype) {
+ unsigned u; /* Local index variable */
/* dump unamed type in root group */
- for(u = 0; u < type_table->nobjs; u++)
- if(!type_table->objs[u].recorded) {
+ for (u = 0; u < type_table->nobjs; u++)
+ if (!type_table->objs[u].recorded) {
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ HDsprintf(type_name, "#" H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
}
} /* end if */
- if(dump_opts.display_oid)
+ if (dump_opts.display_oid)
h5tools_dump_oid(rawoutstream, outputformat, &ctx, gid);
h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid);
@@ -834,8 +850,8 @@ dump_group(hid_t gid, const char *name)
/* Must check for uniqueness of all objects if we've traversed an elink,
* otherwise only check if the reference count > 1.
*/
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
found_obj = search_obj(group_table, oinfo.addr);
@@ -849,7 +865,8 @@ dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s \"%s\"", HARDLINK, found_obj->objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
found_obj->displayed = TRUE;
@@ -869,14 +886,15 @@ dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->groupblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->groupblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupblockend);
- if(HDstrlen(h5tools_dump_header_format->groupend))
+ if (HDstrlen(h5tools_dump_header_format->groupend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->groupend))
+ if (HDstrlen(h5tools_dump_header_format->groupend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->groupend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -892,35 +910,35 @@ dump_group(hid_t gid, const char *name)
void
dump_dataset(hid_t did, const char *name, struct subset_t *sset)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hid_t type, space;
- unsigned attr_crt_order_flags;
- hid_t dcpl_id; /* dataset creation property list ID */
- h5tools_str_t buffer; /* string into which to render */
- hsize_t curr_pos = 0; /* total data element position */
+ hid_t type, space;
+ unsigned attr_crt_order_flags;
+ hid_t dcpl_id; /* dataset creation property list ID */
+ h5tools_str_t buffer; /* string into which to render */
+ hsize_t curr_pos = 0; /* total data element position */
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
if ((dcpl_id = H5Dget_create_plist(did)) < 0) {
error_msg("error in getting creation property list ID\n");
@@ -939,19 +957,19 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
+ /* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->datasetbegin, name,
- h5tools_dump_header_format->datasetblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_dump_comment(rawoutstream, outputformat, &ctx, did);
dump_indent += COL;
ctx.indent_level++;
- type = H5Dget_type(did);
+ type = H5Dget_type(did);
h5dump_type_table = type_table;
h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type);
h5dump_type_table = NULL;
@@ -960,74 +978,74 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space);
H5Sclose(space);
- if(dump_opts.display_oid) {
+ if (dump_opts.display_oid) {
h5tools_dump_oid(rawoutstream, outputformat, &ctx, did);
}
- if(dump_opts.display_dcpl) {
+ if (dump_opts.display_dcpl) {
h5dump_type_table = type_table;
h5tools_dump_dcpl(rawoutstream, outputformat, &ctx, dcpl_id, type, did);
h5dump_type_table = NULL;
}
H5Pclose(dcpl_id);
- ctx.sset = sset;
+ ctx.sset = sset;
ctx.display_index = dump_opts.display_ai;
- ctx.display_char = dump_opts.display_char;
- if(dump_opts.display_data) {
- unsigned data_loop = 1;
- unsigned u;
+ ctx.display_char = dump_opts.display_char;
+ if (dump_opts.display_data) {
+ unsigned data_loop = 1;
+ unsigned u;
- if(dump_opts.display_packed_bits)
+ if (dump_opts.display_packed_bits)
data_loop = packed_bits_num;
- for(u = 0; u < data_loop; u++) {
- if(dump_opts.display_packed_bits) {
+ for (u = 0; u < data_loop; u++) {
+ if (dump_opts.display_packed_bits) {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
/* Render the element */
h5tools_str_reset(&buffer);
- packed_data_mask = packed_mask[u];
+ packed_data_mask = packed_mask[u];
packed_data_offset = packed_offset[u];
packed_data_length = packed_length[u];
h5tools_print_packed_bits(&buffer, type);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
- switch(H5Tget_class(type)) {
- case H5T_TIME:
- ctx.indent_level++;
+ switch (H5Tget_class(type)) {
+ case H5T_TIME:
+ ctx.indent_level++;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "DATA{ not yet implemented.}");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "DATA{ not yet implemented.}");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
- break;
+ ctx.indent_level--;
+ break;
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_COMPOUND:
- case H5T_REFERENCE:
- case H5T_ENUM:
- case H5T_VLEN:
- case H5T_ARRAY:
- {
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY: {
h5tools_dump_data(rawoutstream, outputformat, &ctx, did, TRUE);
- }
- break;
+ } break;
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- default:
- error_msg("invalid H5TCLASS type\n");
- break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
+ error_msg("invalid H5TCLASS type\n");
+ break;
} /* end switch */
- } /* for(u=0; u<data_loop; u++) */
+ } /* for(u=0; u<data_loop; u++) */
}
H5Tclose(type);
@@ -1042,14 +1060,15 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->datasetblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
- if(HDstrlen(h5tools_dump_header_format->datasetend))
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->datasetend))
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -1065,8 +1084,8 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
void
dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
{
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
int print_dataset = FALSE;
@@ -1074,32 +1093,31 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
- ctx.sset = sset;
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
+ ctx.sset = sset;
ctx.display_index = display_index;
- ctx.display_char = dump_opts.display_char;
+ ctx.display_char = dump_opts.display_char;
- if(obj_data == DATASET_DATA)
+ if (obj_data == DATASET_DATA)
print_dataset = TRUE;
h5tools_dump_data(rawoutstream, outputformat, &ctx, obj_id, print_dataset);
}
-
/*-------------------------------------------------------------------------
* Function: dump_fcpl
*
@@ -1111,125 +1129,126 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
void
dump_fcpl(hid_t fid)
{
- hid_t fcpl; /* file creation property list ID */
- hsize_t userblock; /* userblock size retrieved from FCPL */
- size_t off_size; /* size of offsets in the file */
- size_t len_size; /* size of lengths in the file */
- H5F_fspace_strategy_t fs_strategy; /* file space strategy */
- hbool_t fs_persist; /* Persisting free-space or not */
- hsize_t fs_threshold; /* free-space section threshold */
- hsize_t fsp_size; /* file space page size */
- H5F_info2_t finfo; /* file information */
+ hid_t fcpl; /* file creation property list ID */
+ hsize_t userblock; /* userblock size retrieved from FCPL */
+ size_t off_size; /* size of offsets in the file */
+ size_t len_size; /* size of lengths in the file */
+ H5F_fspace_strategy_t fs_strategy; /* file space strategy */
+ hbool_t fs_persist; /* Persisting free-space or not */
+ hsize_t fs_threshold; /* free-space section threshold */
+ hsize_t fsp_size; /* file space page size */
+ H5F_info2_t finfo; /* file information */
#ifdef SHOW_FILE_DRIVER
- hid_t fapl; /* file access property list ID */
- hid_t fdriver; /* file driver */
- char dname[32]; /* buffer to store driver name */
+ hid_t fapl; /* file access property list ID */
+ hid_t fdriver; /* file driver */
+ char dname[32]; /* buffer to store driver name */
#endif
unsigned sym_lk; /* symbol table B-tree leaf 'K' value */
unsigned sym_ik; /* symbol table B-tree internal 'K' value */
unsigned istore_ik; /* indexed storage B-tree internal 'K' value */
- fcpl=H5Fget_create_plist(fid);
+ fcpl = H5Fget_create_plist(fid);
H5Fget_info2(fid, &finfo);
- H5Pget_userblock(fcpl,&userblock);
- H5Pget_sizes(fcpl,&off_size,&len_size);
- H5Pget_sym_k(fcpl,&sym_ik,&sym_lk);
- H5Pget_istore_k(fcpl,&istore_ik);
+ H5Pget_userblock(fcpl, &userblock);
+ H5Pget_sizes(fcpl, &off_size, &len_size);
+ H5Pget_sym_k(fcpl, &sym_ik, &sym_lk);
+ H5Pget_istore_k(fcpl, &istore_ik);
H5Pget_file_space_strategy(fcpl, &fs_strategy, &fs_persist, &fs_threshold);
H5Pget_file_space_page_size(fcpl, &fsp_size);
H5Pclose(fcpl);
#ifdef SHOW_FILE_DRIVER
- fapl=h5_fileaccess();
- fdriver=H5Pget_driver(fapl);
+ fapl = h5_fileaccess();
+ fdriver = H5Pget_driver(fapl);
H5Pclose(fapl);
#endif
- /*-------------------------------------------------------------------------
- * SUPER_BLOCK
- *-------------------------------------------------------------------------
- */
- PRINTSTREAM(rawoutstream, "\n%s %s\n",SUPER_BLOCK, BEGIN);
+ /*-------------------------------------------------------------------------
+ * SUPER_BLOCK
+ *-------------------------------------------------------------------------
+ */
+ PRINTSTREAM(rawoutstream, "\n%s %s\n", SUPER_BLOCK, BEGIN);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","SUPERBLOCK_VERSION", finfo.super.version);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "SUPERBLOCK_VERSION", finfo.super.version);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","FREELIST_VERSION", finfo.free.version);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "FREELIST_VERSION", finfo.free.version);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","SYMBOLTABLE_VERSION", 0); /* Retain this for backward compatibility, for now (QAK) */
+ PRINTSTREAM(rawoutstream, "%s %u\n", "SYMBOLTABLE_VERSION",
+ 0); /* Retain this for backward compatibility, for now (QAK) */
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","OBJECTHEADER_VERSION", finfo.sohm.version);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "OBJECTHEADER_VERSION", finfo.sohm.version);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream,"%s %zu\n","OFFSET_SIZE", off_size);
+ PRINTSTREAM(rawoutstream, "%s %zu\n", "OFFSET_SIZE", off_size);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream,"%s %zu\n","LENGTH_SIZE", len_size);
+ PRINTSTREAM(rawoutstream, "%s %zu\n", "LENGTH_SIZE", len_size);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","BTREE_RANK", sym_ik);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "BTREE_RANK", sym_ik);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %d\n","BTREE_LEAF", sym_lk);
+ PRINTSTREAM(rawoutstream, "%s %d\n", "BTREE_LEAF", sym_lk);
#ifdef SHOW_FILE_DRIVER
- if(H5FD_CORE==fdriver)
- HDstrcpy(dname,"H5FD_CORE");
+ if (H5FD_CORE == fdriver)
+ HDstrcpy(dname, "H5FD_CORE");
#ifdef H5_HAVE_DIRECT
- else if(H5FD_DIRECT==fdriver)
- HDstrcpy(dname,"H5FD_DIRECT");
+ else if (H5FD_DIRECT == fdriver)
+ HDstrcpy(dname, "H5FD_DIRECT");
#endif
- else if(H5FD_FAMILY==fdriver)
- HDstrcpy(dname,"H5FD_FAMILY");
- else if(H5FD_LOG==fdriver)
- HDstrcpy(dname,"H5FD_LOG");
- else if(H5FD_MPIO==fdriver)
- HDstrcpy(dname,"H5FD_MPIO");
- else if(H5FD_MULTI==fdriver)
- HDstrcpy(dname,"H5FD_MULTI");
- else if(H5FD_SEC2==fdriver)
- HDstrcpy(dname,"H5FD_SEC2");
- else if(H5FD_STDIO==fdriver)
- HDstrcpy(dname,"H5FD_STDIO");
+ else if (H5FD_FAMILY == fdriver)
+ HDstrcpy(dname, "H5FD_FAMILY");
+ else if (H5FD_LOG == fdriver)
+ HDstrcpy(dname, "H5FD_LOG");
+ else if (H5FD_MPIO == fdriver)
+ HDstrcpy(dname, "H5FD_MPIO");
+ else if (H5FD_MULTI == fdriver)
+ HDstrcpy(dname, "H5FD_MULTI");
+ else if (H5FD_SEC2 == fdriver)
+ HDstrcpy(dname, "H5FD_SEC2");
+ else if (H5FD_STDIO == fdriver)
+ HDstrcpy(dname, "H5FD_STDIO");
else
- HDstrcpy(dname,"Unknown driver");
+ HDstrcpy(dname, "Unknown driver");
- /* Take out this because the driver used can be different from the
- * standard output. */
- /*indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/
+ /* Take out this because the driver used can be different from the
+ * standard output. */
+ /*indentation(dump_indent + COL);
+ PRINTSTREAM(rawoutstream, "%s %s\n","FILE_DRIVER", dname);*/
#endif
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %u\n","ISTORE_K", istore_ik);
+ PRINTSTREAM(rawoutstream, "%s %u\n", "ISTORE_K", istore_ik);
indentation(dump_indent + COL);
- if(fs_strategy == H5F_FSPACE_STRATEGY_FSM_AGGR) {
+ if (fs_strategy == H5F_FSPACE_STRATEGY_FSM_AGGR) {
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FSPACE_STRATEGY_FSM_AGGR");
}
- else if(fs_strategy == H5F_FSPACE_STRATEGY_PAGE) {
+ else if (fs_strategy == H5F_FSPACE_STRATEGY_PAGE) {
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FSPACE_STRATEGY_PAGE");
}
- else if(fs_strategy == H5F_FSPACE_STRATEGY_AGGR) {
+ else if (fs_strategy == H5F_FSPACE_STRATEGY_AGGR) {
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FSPACE_STRATEGY_AGGR");
}
- else if(fs_strategy == H5F_FSPACE_STRATEGY_NONE) {
+ else if (fs_strategy == H5F_FSPACE_STRATEGY_NONE) {
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "H5F_FSPACE_STRATEGY_NONE");
}
else
PRINTSTREAM(rawoutstream, "%s %s\n", "FILE_SPACE_STRATEGY", "Unknown strategy");
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %s\n","FREE_SPACE_PERSIST", fs_persist ? "TRUE" : "FALSE");
+ PRINTSTREAM(rawoutstream, "%s %s\n", "FREE_SPACE_PERSIST", fs_persist ? "TRUE" : "FALSE");
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %Hu\n","FREE_SPACE_SECTION_THRESHOLD", fs_threshold);
+ PRINTSTREAM(rawoutstream, "%s %Hu\n", "FREE_SPACE_SECTION_THRESHOLD", fs_threshold);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s %Hu\n","FILE_SPACE_PAGE_SIZE", fsp_size);
+ PRINTSTREAM(rawoutstream, "%s %Hu\n", "FILE_SPACE_PAGE_SIZE", fsp_size);
/*-------------------------------------------------------------------------
- * USER_BLOCK
- *-------------------------------------------------------------------------
- */
+ * USER_BLOCK
+ *-------------------------------------------------------------------------
+ */
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "USER_BLOCK %s\n",BEGIN);
+ PRINTSTREAM(rawoutstream, "USER_BLOCK %s\n", BEGIN);
indentation(dump_indent + COL + COL);
- PRINTSTREAM(rawoutstream,"%s %Hu\n","USERBLOCK_SIZE", userblock);
+ PRINTSTREAM(rawoutstream, "%s %Hu\n", "USERBLOCK_SIZE", userblock);
indentation(dump_indent + COL);
- PRINTSTREAM(rawoutstream, "%s\n",END);
+ PRINTSTREAM(rawoutstream, "%s\n", END);
- PRINTSTREAM(rawoutstream, "%s",END);
+ PRINTSTREAM(rawoutstream, "%s", END);
}
/*-------------------------------------------------------------------------
@@ -1243,7 +1262,7 @@ dump_fcpl(hid_t fid)
void
dump_fcontents(hid_t fid)
{
- PRINTSTREAM(rawoutstream, "%s %s\n",FILE_CONTENTS, BEGIN);
+ PRINTSTREAM(rawoutstream, "%s %s\n", FILE_CONTENTS, BEGIN);
/* special case of unamed types in root group */
if (unamedtype) {
@@ -1251,59 +1270,60 @@ dump_fcontents(hid_t fid)
for (u = 0; u < type_table->nobjs; u++) {
if (!type_table->objs[u].recorded)
- PRINTSTREAM(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno);
+ PRINTSTREAM(rawoutstream, " %-10s /#" H5_PRINTF_HADDR_FMT "\n", "datatype",
+ type_table->objs[u].objno);
}
}
/* print objects in the files */
h5trav_print(fid);
- PRINTSTREAM(rawoutstream, " %s\n",END);
+ PRINTSTREAM(rawoutstream, " %s\n", END);
}
static herr_t
attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data)
{
- herr_t ret = SUCCEED;
- int j;
- char *obj_op_name;
- char *obj_name;
- trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data;
- const char *buf = attr_data->path;
- const char *op_name = attr_data->op_name;
+ herr_t ret = SUCCEED;
+ int j;
+ char * obj_op_name;
+ char * obj_name;
+ trav_attr_udata_t *attr_data = (trav_attr_udata_t *)_op_data;
+ const char * buf = attr_data->path;
+ const char * op_name = attr_data->op_name;
j = (int)HDstrlen(op_name) - 1;
/* find the last / */
- while(j >= 0) {
- if(op_name[j] == '/' && (j == 0 || (j > 0 && op_name[j - 1] != '\\')))
+ while (j >= 0) {
+ if (op_name[j] == '/' && (j == 0 || (j > 0 && op_name[j - 1] != '\\')))
break;
j--;
}
obj_op_name = h5tools_str_replace(op_name + j + 1, "\\/", "/");
- if(obj_op_name == NULL) {
+ if (obj_op_name == NULL) {
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- if(HDstrcmp(attr_name, obj_op_name)==0) {
+ if (HDstrcmp(attr_name, obj_op_name) == 0) {
size_t u, v, w;
/* object name */
- u = HDstrlen(buf);
- v = HDstrlen(op_name);
- w = u + 1 + v + 1 + 2;
+ u = HDstrlen(buf);
+ v = HDstrlen(op_name);
+ w = u + 1 + v + 1 + 2;
obj_name = (char *)HDmalloc(w);
- if(obj_name == NULL) {
+ if (obj_name == NULL) {
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
HDmemset(obj_name, '\0', w);
- if(op_name[0] != '/') {
+ if (op_name[0] != '/') {
HDstrncat(obj_name, buf, u + 1);
- if(buf[u - 1] != '/')
+ if (buf[u - 1] != '/')
HDstrncat(obj_name, "/", (size_t)2);
}
HDstrncat(obj_name, op_name, v + 1);
@@ -1320,16 +1340,17 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a
static herr_t
obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data)
{
- trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
- const char *op_name = handle_data->op_name;
- trav_attr_udata_t attr_data;
+ trav_handle_udata_t *handle_data = (trav_handle_udata_t *)_op_data;
+ const char * op_name = handle_data->op_name;
+ trav_attr_udata_t attr_data;
- attr_data.path = path;
+ attr_data.path = path;
attr_data.op_name = op_name;
- H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search, (void*)&attr_data, H5P_DEFAULT);
+ H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search,
+ (void *)&attr_data, H5P_DEFAULT);
- if(HDstrcmp(path, op_name) == 0) {
- switch(oi->type) {
+ if (HDstrcmp(path, op_name) == 0) {
+ switch (oi->type) {
case H5O_TYPE_GROUP:
handle_groups(handle_data->fid, path, NULL, 0, NULL);
break;
@@ -1356,19 +1377,19 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al
static herr_t
lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
{
- size_t search_len;
- size_t k;
- char *search_name;
- trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
- const char *op_name = handle_data->op_name;
+ size_t search_len;
+ size_t k;
+ char * search_name;
+ trav_handle_udata_t *handle_data = (trav_handle_udata_t *)_op_data;
+ const char * op_name = handle_data->op_name;
search_len = HDstrlen(op_name);
- if(search_len > 0 && op_name[0] != '/')
+ if (search_len > 0 && op_name[0] != '/')
k = 2;
else
k = 1;
search_name = (char *)HDmalloc(search_len + k);
- if(search_name == NULL) {
+ if (search_name == NULL) {
error_msg("creating temporary link\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1381,20 +1402,20 @@ lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
HDstrncpy(search_name, op_name, search_len + 1);
search_name[search_len + k - 1] = '\0';
- if(HDstrcmp(path, search_name) == 0) {
- switch(li->type) {
- case H5L_TYPE_SOFT:
- case H5L_TYPE_EXTERNAL:
- handle_links(handle_data->fid, op_name, NULL, 0, NULL);
- break;
+ if (HDstrcmp(path, search_name) == 0) {
+ switch (li->type) {
+ case H5L_TYPE_SOFT:
+ case H5L_TYPE_EXTERNAL:
+ handle_links(handle_data->fid, op_name, NULL, 0, NULL);
+ break;
- case H5L_TYPE_HARD:
- case H5L_TYPE_MAX:
- case H5L_TYPE_ERROR:
- default:
- error_msg("unknown link type value\n");
- h5tools_setstatus(EXIT_FAILURE);
- break;
+ case H5L_TYPE_HARD:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_ERROR:
+ default:
+ error_msg("unknown link type value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ break;
} /* end switch() */
}
HDfree(search_name);
@@ -1411,19 +1432,20 @@ lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
*-------------------------------------------------------------------------
*/
void
-handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
+handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name)
{
- hid_t gid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
- if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
+ if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
error_msg("unable to open root group\n");
h5tools_setstatus(EXIT_FAILURE);
}
else {
- hid_t gcpl_id;
- unsigned crt_order_flags;
- unsigned attr_crt_order_flags;
- trav_handle_udata_t handle_udata; /* User data for traversal */
+ hid_t gcpl_id;
+ unsigned crt_order_flags;
+ unsigned attr_crt_order_flags;
+ trav_handle_udata_t handle_udata; /* User data for traversal */
if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
error_msg("error in getting group creation property list ID\n");
@@ -1437,19 +1459,19 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
}
/* query the group creation properties */
- if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
+ if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
error_msg("error in getting group creation properties\n");
h5tools_setstatus(EXIT_FAILURE);
}
- if(H5Pclose(gcpl_id) < 0) {
+ if (H5Pclose(gcpl_id) < 0) {
error_msg("error in closing group creation property list ID\n");
h5tools_setstatus(EXIT_FAILURE);
}
- handle_udata.fid = fid;
+ handle_udata.fid = fid;
handle_udata.op_name = path_name;
- if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata, H5O_INFO_BASIC) < 0) {
+ if (h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata, H5O_INFO_BASIC) < 0) {
error_msg("error traversing information\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1465,33 +1487,34 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
*-------------------------------------------------------------------------
*/
void
-handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
+handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name)
{
- hid_t oid = H5I_INVALID_HID;
- hid_t attr_id = H5I_INVALID_HID;
- char *obj_name = NULL;
- char *attr_name = NULL;
- int j;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &h5tools_dataformat;
+ hid_t oid = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
+ char * obj_name = NULL;
+ char * attr_name = NULL;
+ int j;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
- j = (int)HDstrlen(attr) - 1;
+ j = (int)HDstrlen(attr) - 1;
obj_name = (char *)HDmalloc((size_t)j + 2);
- if(obj_name == NULL)
+ if (obj_name == NULL)
goto error;
/* find the last / */
- while(j >= 0) {
- if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\')))
+ while (j >= 0) {
+ if (attr[j] == '/' && (j == 0 || (j > 0 && attr[j - 1] != '\\')))
break;
j--;
}
/* object name */
- if(j == -1)
+ if (j == -1)
HDstrcpy(obj_name, "/");
else {
HDstrncpy(obj_name, attr, (size_t)j + 1);
@@ -1500,32 +1523,32 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
dump_indent += COL;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.indent_level = dump_indent / COL;
+ ctx.cur_column = dump_indent;
ctx.display_index = dump_opts.display_ai;
- ctx.display_char = dump_opts.display_char;
+ ctx.display_char = dump_opts.display_char;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/");
/* handle error case: cannot open the object with the attribute */
- if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) {
+ if ((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) {
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1533,45 +1556,46 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->attributebegin, attr,
- h5tools_dump_header_format->attributeblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "%s \"%s\" %s", h5tools_dump_header_format->attributebegin, attr,
+ h5tools_dump_header_format->attributeblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
error_msg("unable to open object \"%s\"\n", obj_name);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->attributeblockend)) {
+ if (HDstrlen(h5tools_dump_header_format->attributeblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeblockend);
- if(HDstrlen(h5tools_dump_header_format->attributeend))
+ if (HDstrlen(h5tools_dump_header_format->attributeend))
h5tools_str_append(&buffer, " ");
}
- if(HDstrlen(h5tools_dump_header_format->attributeend))
+ if (HDstrlen(h5tools_dump_header_format->attributeend))
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->attributeend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
goto error;
} /* end if */
- attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
- oid_output = dump_opts.display_oid;
- data_output = dump_opts.display_data;
+ attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
+ oid_output = dump_opts.display_oid;
+ data_output = dump_opts.display_data;
attr_data_output = dump_opts.display_attr_data;
h5dump_type_table = type_table;
h5tools_dump_attribute(rawoutstream, outputformat, &ctx, attr_name, attr_id);
h5dump_type_table = NULL;
- if(attr_id < 0) {
+ if (attr_id < 0) {
goto error;
}
/* Close object */
- if(H5Oclose(oid) < 0) {
+ if (H5Oclose(oid) < 0) {
goto error;
} /* end if */
@@ -1582,16 +1606,18 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
error:
h5tools_setstatus(EXIT_FAILURE);
- if(obj_name)
+ if (obj_name)
HDfree(obj_name);
if (attr_name)
HDfree(attr_name);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Oclose(oid);
H5Aclose(attr_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
dump_indent -= COL;
}
@@ -1608,69 +1634,69 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
{
H5O_info_t oinfo;
hid_t dsetid;
- hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
- struct subset_t *sset = (struct subset_t *)data;
- const char *real_name = display_name ? display_name : dset;
+ hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
+ struct subset_t *sset = (struct subset_t *)data;
+ const char * real_name = display_name ? display_name : dset;
- if(dump_opts.display_data) {
+ if (dump_opts.display_data) {
if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
error_msg("error in creating default access property list ID\n");
}
if (dump_opts.display_vds_first) {
- if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
+ if (H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
error_msg("error in setting access property list ID, virtual_view\n");
}
if (dump_opts.vds_gap_size > 0) {
- if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
+ if (H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
error_msg("error in setting access property list ID, virtual_printf_gap\n");
}
}
- if((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) {
+ if ((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) {
if (pe)
handle_links(fid, dset, data, pe, display_name);
return;
} /* end if */
- if(sset) {
+ if (sset) {
unsigned int i;
unsigned int ndims;
- hid_t sid = H5Dget_space(dsetid);
- int ndims_res = H5Sget_simple_extent_ndims(sid);
+ hid_t sid = H5Dget_space(dsetid);
+ int ndims_res = H5Sget_simple_extent_ndims(sid);
H5Sclose(sid);
- if(ndims_res < 0) {
+ if (ndims_res < 0) {
error_msg("H5Sget_simple_extent_ndims failed\n");
h5tools_setstatus(EXIT_FAILURE);
return;
}
ndims = (unsigned)ndims_res;
- if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) {
+ if (!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) {
/* they didn't specify a ``stride'' or ``block''. default to 1 in all
* dimensions */
- if(!sset->start.data) {
+ if (!sset->start.data) {
/* default to (0, 0, ...) for the start coord */
sset->start.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->start.len = ndims;
+ sset->start.len = ndims;
}
- if(!sset->stride.data) {
+ if (!sset->stride.data) {
sset->stride.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->stride.len = ndims;
+ sset->stride.len = ndims;
for (i = 0; i < ndims; i++)
sset->stride.data[i] = 1;
}
- if(!sset->count.data) {
+ if (!sset->count.data) {
sset->count.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->count.len = ndims;
+ sset->count.len = ndims;
for (i = 0; i < ndims; i++)
sset->count.data[i] = 1;
}
- if(!sset->block.data) {
+ if (!sset->block.data) {
sset->block.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t));
- sset->block.len = ndims;
+ sset->block.len = ndims;
for (i = 0; i < ndims; i++)
sset->block.data[i] = 1;
}
@@ -1680,22 +1706,22 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
* check for dimension overflow
*-------------------------------------------------------------------------
*/
- if(sset->start.len > ndims) {
+ if (sset->start.len > ndims) {
error_msg("number of start dims (%u) exceed dataset dims (%u)\n", sset->start.len, ndims);
h5tools_setstatus(EXIT_FAILURE);
return;
}
- if(sset->stride.len > ndims) {
+ if (sset->stride.len > ndims) {
error_msg("number of stride dims (%u) exceed dataset dims (%u)\n", sset->stride.len, ndims);
h5tools_setstatus(EXIT_FAILURE);
return;
}
- if(sset->count.len > ndims) {
+ if (sset->count.len > ndims) {
error_msg("number of count dims (%u) exceed dataset dims (%u)\n", sset->count.len, ndims);
h5tools_setstatus(EXIT_FAILURE);
return;
}
- if(sset->block.len > ndims) {
+ if (sset->block.len > ndims) {
error_msg("number of block dims (%u) exceed dataset dims (%u)\n", sset->block.len, ndims);
h5tools_setstatus(EXIT_FAILURE);
return;
@@ -1705,29 +1731,29 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
* check for block overlap
*-------------------------------------------------------------------------
*/
- for(i = 0; i < ndims; i++) {
- if(sset->count.data[i] > 1) {
- if(sset->stride.data[i] < sset->block.data[i]) {
+ for (i = 0; i < ndims; i++) {
+ if (sset->count.data[i] > 1) {
+ if (sset->stride.data[i] < sset->block.data[i]) {
error_msg("wrong subset selection; blocks overlap\n");
h5tools_setstatus(EXIT_FAILURE);
return;
} /* end if */
- } /* end if */
- } /* end for */
- } /* end if */
-
+ } /* end if */
+ } /* end for */
+ } /* end if */
H5Oget_info2(dsetid, &oinfo, H5O_INFO_BASIC);
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
found_obj = search_obj(dset_table, oinfo.addr);
- if(found_obj) {
+ if (found_obj) {
if (found_obj->displayed) {
PRINTVALSTREAM(rawoutstream, "\n");
indentation(dump_indent);
- begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin);
+ begin_obj(h5tools_dump_header_format->datasetbegin, real_name,
+ h5tools_dump_header_format->datasetblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");
indentation(dump_indent + COL);
PRINTSTREAM(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname);
@@ -1751,7 +1777,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
}
if (dapl_id != H5P_DEFAULT)
H5Pclose(dapl_id);
- if(H5Dclose(dsetid) < 0)
+ if (H5Dclose(dsetid) < 0)
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1767,12 +1793,13 @@ void
handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, const char *display_name)
{
hid_t gid;
- const char *real_name = display_name ? display_name : group;
+ const char *real_name = display_name ? display_name : group;
- if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) {
+ if ((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) {
if (pe) {
PRINTVALSTREAM(rawoutstream, "\n");
- begin_obj(h5tools_dump_header_format->groupbegin, real_name, h5tools_dump_header_format->groupblockbegin);
+ begin_obj(h5tools_dump_header_format->groupbegin, real_name,
+ h5tools_dump_header_format->groupblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");
indentation(COL);
error_msg("unable to open group \"%s\"\n", real_name);
@@ -1783,9 +1810,9 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c
else {
size_t new_len = HDstrlen(group) + 1;
- if(prefix_len <= new_len) {
+ if (prefix_len <= new_len) {
prefix_len = new_len;
- prefix = (char *)HDrealloc(prefix, prefix_len);
+ prefix = (char *)HDrealloc(prefix, prefix_len);
} /* end if */
HDstrcpy(prefix, group);
@@ -1794,7 +1821,7 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c
dump_group(gid, real_name);
dump_indent -= COL;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
h5tools_setstatus(EXIT_FAILURE);
} /* end else */
} /* end handle_groups() */
@@ -1808,15 +1835,16 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c
*-------------------------------------------------------------------------
*/
void
-handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
+handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name)
{
H5L_info_t linfo;
- if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
+ if (H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
error_msg("unable to get link info from \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
- else if(linfo.type == H5L_TYPE_HARD) {
+ else if (linfo.type == H5L_TYPE_HARD) {
error_msg("\"%s\" is a hard link\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1824,56 +1852,60 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
char *buf = (char *)HDmalloc(linfo.u.val_size);
PRINTVALSTREAM(rawoutstream, "\n");
- switch(linfo.type) {
- case H5L_TYPE_SOFT: /* Soft link */
- begin_obj(h5tools_dump_header_format->softlinkbegin, links, h5tools_dump_header_format->softlinkblockbegin);
- PRINTVALSTREAM(rawoutstream, "\n");
- indentation(COL);
- if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
- PRINTSTREAM(rawoutstream, "LINKTARGET \"%s\"\n", buf);
- }
- else {
- error_msg("h5dump error: unable to get link value for \"%s\"\n", links);
- h5tools_setstatus(EXIT_FAILURE);
- }
- end_obj(h5tools_dump_header_format->softlinkend, h5tools_dump_header_format->softlinkblockend);
- break;
+ switch (linfo.type) {
+ case H5L_TYPE_SOFT: /* Soft link */
+ begin_obj(h5tools_dump_header_format->softlinkbegin, links,
+ h5tools_dump_header_format->softlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(COL);
+ if (H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
+ PRINTSTREAM(rawoutstream, "LINKTARGET \"%s\"\n", buf);
+ }
+ else {
+ error_msg("h5dump error: unable to get link value for \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ end_obj(h5tools_dump_header_format->softlinkend,
+ h5tools_dump_header_format->softlinkblockend);
+ break;
- case H5L_TYPE_EXTERNAL:
- begin_obj(h5tools_dump_header_format->extlinkbegin, links, h5tools_dump_header_format->extlinkblockbegin);
- PRINTVALSTREAM(rawoutstream, "\n");
- if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
- const char *elink_file;
- const char *elink_path;
-
- if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path)>=0) {
- indentation(COL);
- PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file);
- indentation(COL);
- PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path);
+ case H5L_TYPE_EXTERNAL:
+ begin_obj(h5tools_dump_header_format->extlinkbegin, links,
+ h5tools_dump_header_format->extlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ if (H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) {
+ const char *elink_file;
+ const char *elink_path;
+
+ if (H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path) >= 0) {
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file);
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path);
+ }
+ else {
+ error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
}
else {
- error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links);
+ error_msg("h5dump error: unable to get external link value for \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
- }
- else {
- error_msg("h5dump error: unable to get external link value for \"%s\"\n", links);
- h5tools_setstatus(EXIT_FAILURE);
- }
- end_obj(h5tools_dump_header_format->extlinkend, h5tools_dump_header_format->extlinkblockend);
- break;
+ end_obj(h5tools_dump_header_format->extlinkend, h5tools_dump_header_format->extlinkblockend);
+ break;
- case H5L_TYPE_ERROR:
- case H5L_TYPE_MAX:
- case H5L_TYPE_HARD:
- default:
- begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin);
- PRINTVALSTREAM(rawoutstream, "\n");
- indentation(COL);
- PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type);
- end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend);
- break;
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default:
+ begin_obj(h5tools_dump_header_format->udlinkbegin, links,
+ h5tools_dump_header_format->udlinkblockbegin);
+ PRINTVALSTREAM(rawoutstream, "\n");
+ indentation(COL);
+ PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type);
+ end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend);
+ break;
} /* end switch */
HDfree(buf);
} /* end else */
@@ -1888,44 +1920,46 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
*-------------------------------------------------------------------------
*/
void
-handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe, const char *display_name)
+handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED *data, int pe, const char *display_name)
{
hid_t type_id;
- const char *real_name = display_name ? display_name : type;
+ const char *real_name = display_name ? display_name : type;
- if((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) {
+ if ((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) {
/* check if type is unamed datatype */
unsigned idx = 0;
- while(idx < type_table->nobjs ) {
+ while (idx < type_table->nobjs) {
char name[128];
- if(!type_table->objs[idx].recorded) {
+ if (!type_table->objs[idx].recorded) {
/* unamed datatype */
- HDsprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
+ HDsprintf(name, "/#" H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
- if(!HDstrcmp(name, real_name))
+ if (!HDstrcmp(name, real_name))
break;
} /* end if */
idx++;
} /* end while */
- if(idx == type_table->nobjs) {
+ if (idx == type_table->nobjs) {
if (pe) {
/* unknown type */
PRINTVALSTREAM(rawoutstream, "\n");
- begin_obj(h5tools_dump_header_format->datatypebegin, real_name, h5tools_dump_header_format->datatypeblockbegin);
+ begin_obj(h5tools_dump_header_format->datatypebegin, real_name,
+ h5tools_dump_header_format->datatypeblockbegin);
PRINTVALSTREAM(rawoutstream, "\n");
indentation(COL);
error_msg("unable to open datatype \"%s\"\n", real_name);
- end_obj(h5tools_dump_header_format->datatypeend, h5tools_dump_header_format->datatypeblockend);
+ end_obj(h5tools_dump_header_format->datatypeend,
+ h5tools_dump_header_format->datatypeblockend);
h5tools_setstatus(EXIT_FAILURE);
}
}
else {
hid_t dsetid = H5Dopen2(fid, type_table->objs[idx].objname, H5P_DEFAULT);
- type_id = H5Dget_type(dsetid);
+ type_id = H5Dget_type(dsetid);
dump_indent += COL;
dump_named_datatype(type_id, real_name);
@@ -1940,12 +1974,11 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe
dump_named_datatype(type_id, real_name);
dump_indent -= COL;
- if(H5Tclose(type_id) < 0)
+ if (H5Tclose(type_id) < 0)
h5tools_setstatus(EXIT_FAILURE);
}
}
-
/*-------------------------------------------------------------------------
* Function: dump_extlink
*
@@ -1959,13 +1992,13 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe
static int
dump_extlink(hid_t group, const char *linkname, const char *objname)
{
- hid_t oid;
- H5O_info_t oi;
- table_t *old_group_table = group_table;
- table_t *old_dset_table = dset_table;
- table_t *old_type_table = type_table;
- hbool_t old_hit_elink;
- ssize_t idx;
+ hid_t oid;
+ H5O_info_t oi;
+ table_t * old_group_table = group_table;
+ table_t * old_dset_table = dset_table;
+ table_t * old_type_table = type_table;
+ hbool_t old_hit_elink;
+ ssize_t idx;
/* Open target object */
if ((oid = H5Oopen(group, linkname, H5P_DEFAULT)) < 0)
@@ -1990,12 +2023,12 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
if (idx) {
/* Update table pointers */
group_table = table_list.tables[idx].group_table;
- dset_table = table_list.tables[idx].dset_table;
- type_table = table_list.tables[idx].type_table;
+ dset_table = table_list.tables[idx].dset_table;
+ type_table = table_list.tables[idx].type_table;
/* We will now traverse the external link, set this global to indicate this */
old_hit_elink = hit_elink;
- hit_elink = TRUE;
+ hit_elink = TRUE;
/* add some indentation to distinguish that these objects are external */
dump_indent += COL;
@@ -2024,8 +2057,8 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
/* Reset table pointers */
group_table = old_group_table;
- dset_table = old_dset_table;
- type_table = old_type_table;
+ dset_table = old_dset_table;
+ type_table = old_type_table;
/* Reset hit_elink */
hit_elink = old_hit_elink;
@@ -2039,4 +2072,3 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
fail:
return FAIL;
}
-
diff --git a/tools/src/h5dump/h5dump_ddl.h b/tools/src/h5dump/h5dump_ddl.h
index ae01086..00b7c46 100644
--- a/tools/src/h5dump/h5dump_ddl.h
+++ b/tools/src/h5dump/h5dump_ddl.h
@@ -20,17 +20,17 @@ extern "C" {
/* The dump functions of the dump_function_table */
/* standard format: no change */
-void dump_group(hid_t, const char *);
-void dump_named_datatype(hid_t, const char *);
-void dump_dataset(hid_t, const char *, struct subset_t *);
-void dump_dataspace(hid_t space);
-void dump_datatype(hid_t type);
-void dump_data(hid_t, int, struct subset_t *, int);
-void dump_fcpl(hid_t fid);
-void dump_fcontents(hid_t fid);
+void dump_group(hid_t, const char *);
+void dump_named_datatype(hid_t, const char *);
+void dump_dataset(hid_t, const char *, struct subset_t *);
+void dump_dataspace(hid_t space);
+void dump_datatype(hid_t type);
+void dump_data(hid_t, int, struct subset_t *, int);
+void dump_fcpl(hid_t fid);
+void dump_fcontents(hid_t fid);
/* callback function used by H5Aiterate2() */
-herr_t dump_attr_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data);
+herr_t dump_attr_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info, void *_op_data);
/* other iteration functions */
void link_iteration(hid_t gid, unsigned crt_order_flags);
@@ -38,13 +38,16 @@ void attr_iteration(hid_t gid, unsigned attr_crt_order_flags);
void handle_paths(hid_t fid, const char *path_name, void *data, int pe, const char *display_name);
void handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name);
-void handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name);
+void handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name);
void handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, const char *display_name);
-void handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name);
-void handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe, const char *display_name);
+void handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe,
+ const char H5_ATTR_UNUSED *display_name);
+void handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED *data, int pe,
+ const char *display_name);
#ifdef __cplusplus
}
#endif
-#endif /* !H5DUMP_DDL_H__ */
+#endif /* !H5DUMP_DDL_H__ */
diff --git a/tools/src/h5dump/h5dump_defines.h b/tools/src/h5dump/h5dump_defines.h
index 7a9d4c0..669fae6 100644
--- a/tools/src/h5dump/h5dump_defines.h
+++ b/tools/src/h5dump/h5dump_defines.h
@@ -13,42 +13,41 @@
#ifndef H5DUMP_DEFINES_H__
#define H5DUMP_DEFINES_H__
-#define H5DUMP_MAX_RANK H5S_MAX_RANK
+#define H5DUMP_MAX_RANK H5S_MAX_RANK
-#define ATTRIBUTE_DATA 0
-#define DATASET_DATA 1
-#define ENUM_DATA 2
-#define COL 3
+#define ATTRIBUTE_DATA 0
+#define DATASET_DATA 1
+#define ENUM_DATA 2
+#define COL 3
/* Macros for displaying objects */
-#define begin_obj(obj,name,begin) \
- do { \
- if ((name)) { \
- PRINTSTREAM(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \
- } \
- else { \
- PRINTSTREAM(rawoutstream, "%s %s", (obj), (begin)); \
- } \
- } while(0);
-
-#define end_obj(obj,end) \
- do { \
- if(HDstrlen(end)) { \
- PRINTSTREAM(rawoutstream, "%s", end); \
- if(HDstrlen(obj)) \
- PRINTVALSTREAM(rawoutstream, " "); \
- } \
- if(HDstrlen(obj)) \
- PRINTSTREAM(rawoutstream, "%s", obj); \
- } while(0);
+#define begin_obj(obj, name, begin) \
+ do { \
+ if ((name)) { \
+ PRINTSTREAM(rawoutstream, "%s \"%s\" %s", (obj), (name), (begin)); \
+ } \
+ else { \
+ PRINTSTREAM(rawoutstream, "%s %s", (obj), (begin)); \
+ } \
+ } while (0);
+#define end_obj(obj, end) \
+ do { \
+ if (HDstrlen(end)) { \
+ PRINTSTREAM(rawoutstream, "%s", end); \
+ if (HDstrlen(obj)) \
+ PRINTVALSTREAM(rawoutstream, " "); \
+ } \
+ if (HDstrlen(obj)) \
+ PRINTSTREAM(rawoutstream, "%s", obj); \
+ } while (0);
/* 3 private values: can't be set, but can be read.
Note: these are defined in H5Zprivate, they are
duplicated here.
*/
-#define H5_SZIP_LSB_OPTION_MASK 8
-#define H5_SZIP_MSB_OPTION_MASK 16
-#define H5_SZIP_RAW_OPTION_MASK 128
+#define H5_SZIP_LSB_OPTION_MASK 8
+#define H5_SZIP_MSB_OPTION_MASK 16
+#define H5_SZIP_RAW_OPTION_MASK 128
-#endif /* !H5DUMP_DEFINES_H__ */
+#endif /* !H5DUMP_DEFINES_H__ */
diff --git a/tools/src/h5dump/h5dump_extern.h b/tools/src/h5dump/h5dump_extern.h
index c615621..6ccd159 100644
--- a/tools/src/h5dump/h5dump_extern.h
+++ b/tools/src/h5dump/h5dump_extern.h
@@ -26,64 +26,65 @@
**/
/* the table of dump functions */
typedef struct dump_functions_t {
- void (*dump_group_function) (hid_t, const char *);
- void (*dump_named_datatype_function) (hid_t, const char *);
- void (*dump_dataset_function) (hid_t, const char *, struct subset_t *);
- void (*dump_dataspace_function) (hid_t);
- void (*dump_datatype_function) (hid_t);
- herr_t (*dump_attribute_function) (hid_t, const char *, const H5A_info_t *, void *);
- void (*dump_data_function) (hid_t, int, struct subset_t *, int);
+ void (*dump_group_function)(hid_t, const char *);
+ void (*dump_named_datatype_function)(hid_t, const char *);
+ void (*dump_dataset_function)(hid_t, const char *, struct subset_t *);
+ void (*dump_dataspace_function)(hid_t);
+ void (*dump_datatype_function)(hid_t);
+ herr_t (*dump_attribute_function)(hid_t, const char *, const H5A_info_t *, void *);
+ void (*dump_data_function)(hid_t, int, struct subset_t *, int);
} dump_functions;
/* List of table structures. There is one table structure for each file */
typedef struct h5dump_table_list_t {
- size_t nalloc;
- size_t nused;
+ size_t nalloc;
+ size_t nused;
struct {
- unsigned long fileno; /* File number that these tables refer to */
- hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
- table_t *group_table; /* Table of groups */
- table_t *dset_table; /* Table of datasets */
- table_t *type_table; /* Table of datatypes */
- } *tables;
+ unsigned long fileno; /* File number that these tables refer to */
+ hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
+ table_t * group_table; /* Table of groups */
+ table_t * dset_table; /* Table of datasets */
+ table_t * type_table; /* Table of datatypes */
+ } * tables;
} h5dump_table_list_t;
-extern h5dump_table_list_t table_list;
-extern table_t *group_table, *dset_table, *type_table;
+extern h5dump_table_list_t table_list;
+extern table_t * group_table, *dset_table, *type_table;
-extern unsigned dump_indent; /* how far in to indent the line */
-extern int unamedtype; /* shared datatype with no name */
-extern hbool_t hit_elink; /* whether we have traversed an external link */
-extern size_t prefix_len;
-extern char *prefix;
-extern const char *fp_format;
+extern unsigned dump_indent; /* how far in to indent the line */
+extern int unamedtype; /* shared datatype with no name */
+extern hbool_t hit_elink; /* whether we have traversed an external link */
+extern size_t prefix_len;
+extern char * prefix;
+extern const char *fp_format;
/* things to display or which are set via command line parameters */
typedef struct {
- int display_all;
- int display_oid;
- int display_data;
- int display_attr_data;
- int display_char; /* print 1-byte numbers as ASCII */
- int usingdasho;
- int display_bb; /* superblock */
- int display_dcpl; /* dcpl */
- int display_fi; /* file index */
- int display_ai; /* array index */
- int display_escape; /* escape non printable characters */
- int display_region; /* print region reference data */
- int disable_compact_subset; /* disable compact form of subset notation */
- int display_packed_bits; /* print 1-8 byte numbers as packed bits */
- int include_attrs; /* Display attributes */
- int display_vds_first; /* vds display to all by default */
- int vds_gap_size; /* vds skip missing files default is none */
+ int display_all;
+ int display_oid;
+ int display_data;
+ int display_attr_data;
+ int display_char; /* print 1-byte numbers as ASCII */
+ int usingdasho;
+ int display_bb; /* superblock */
+ int display_dcpl; /* dcpl */
+ int display_fi; /* file index */
+ int display_ai; /* array index */
+ int display_escape; /* escape non printable characters */
+ int display_region; /* print region reference data */
+ int disable_compact_subset; /* disable compact form of subset notation */
+ int display_packed_bits; /* print 1-8 byte numbers as packed bits */
+ int include_attrs; /* Display attributes */
+ int display_vds_first; /* vds display to all by default */
+ int vds_gap_size; /* vds skip missing files default is none */
} dump_opt_t;
extern dump_opt_t dump_opts;
-#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
-#define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */
+#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
+#define PACKED_BITS_SIZE_MAX 8 * sizeof(long long) /* Maximum bits size of integer types of packed-bits */
/* mask list for packed bits */
-extern unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
+extern unsigned long long
+ packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
/* packed bits display parameters */
extern unsigned packed_offset[PACKED_BITS_MAX];
@@ -99,13 +100,13 @@ extern const dump_functions *dump_function_table;
extern "C" {
#endif
-void add_prefix(char **prfx, size_t *prfx_len, const char *name);
-hid_t h5_fileaccess(void);
-ssize_t table_list_add(hid_t oid, unsigned long file_no);
-ssize_t table_list_visited(unsigned long file_no);
+void add_prefix(char **prfx, size_t *prfx_len, const char *name);
+hid_t h5_fileaccess(void);
+ssize_t table_list_add(hid_t oid, unsigned long file_no);
+ssize_t table_list_visited(unsigned long file_no);
#ifdef __cplusplus
}
#endif
-#endif /* !H5DUMP_EXTERN_H__ */
+#endif /* !H5DUMP_EXTERN_H__ */
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index f2cca21..8a40b25 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -20,7 +20,7 @@
#include "h5dump_extern.h"
#include "h5dump_xml.h"
-const char *xmlnsprefix="hdf5:";
+const char *xmlnsprefix = "hdf5:";
/*
* Alternative formating for data dumped to XML
@@ -34,53 +34,54 @@ const char *xmlnsprefix="hdf5:";
*
* This table only affects XML output.
*/
-static h5tool_format_t xml_dataformat = {
- 0, /*raw */
-
- "", /*fmt_raw */
- "%d", /*fmt_int */
- "%u", /*fmt_uint */
- "%hhd", /*fmt_schar */
- "%u", /*fmt_uchar */
- "%d", /*fmt_short */
- "%u", /*fmt_ushort */
- "%ld", /*fmt_long */
- "%lu", /*fmt_ulong */
- NULL, /*fmt_llong */
- NULL, /*fmt_ullong */
- "%g", /*fmt_double */
- "%g", /*fmt_float */
-
- 0, /*ascii */
- 0, /*str_locale */
- 0, /*str_repeat */
-
- "", /*arr_pre */
- "", /*arr_sep */
- "", /*arr_suf */
- 1, /*arr_linebreak */
-
- "", /*cmpd_name */
- "", /*cmpd_sep */
- "", /*cmpd_pre */
- "", /*cmpd_suf */
- "", /*cmpd_end */
- NULL, /*cmpd_listv */
-
- " ", /*vlen_sep */
- " ", /*vlen_pre */
- "", /*vlen_suf */
- "", /*vlen_end */
-
- "%s", /*elmt_fmt */
- "", /*elmt_suf1 */
- " ", /*elmt_suf2 */
-
- "", /*idx_n_fmt */
- "", /*idx_sep */
- "", /*idx_fmt */
-
- 80, /*line_ncols *//*standard default columns */
+static h5tool_format_t xml_dataformat = {
+ 0, /*raw */
+
+ "", /*fmt_raw */
+ "%d", /*fmt_int */
+ "%u", /*fmt_uint */
+ "%hhd", /*fmt_schar */
+ "%u", /*fmt_uchar */
+ "%d", /*fmt_short */
+ "%u", /*fmt_ushort */
+ "%ld", /*fmt_long */
+ "%lu", /*fmt_ulong */
+ NULL, /*fmt_llong */
+ NULL, /*fmt_ullong */
+ "%g", /*fmt_double */
+ "%g", /*fmt_float */
+
+ 0, /*ascii */
+ 0, /*str_locale */
+ 0, /*str_repeat */
+
+ "", /*arr_pre */
+ "", /*arr_sep */
+ "", /*arr_suf */
+ 1, /*arr_linebreak */
+
+ "", /*cmpd_name */
+ "", /*cmpd_sep */
+ "", /*cmpd_pre */
+ "", /*cmpd_suf */
+ "", /*cmpd_end */
+ NULL, /*cmpd_listv */
+
+ " ", /*vlen_sep */
+ " ", /*vlen_pre */
+ "", /*vlen_suf */
+ "", /*vlen_end */
+
+ "%s", /*elmt_fmt */
+ "", /*elmt_suf1 */
+ " ", /*elmt_suf2 */
+
+ "", /*idx_n_fmt */
+ "", /*idx_sep */
+ "", /*idx_fmt */
+
+ 80,
+ /*line_ncols */ /*standard default columns */
0, /*line_per_line */
"", /*line_pre */
"%s", /*line_1st */
@@ -90,31 +91,30 @@ static h5tool_format_t xml_dataformat = {
1, /*line_multi_new */
" ", /*line_indent */
- 1, /*skip_first */
+ 1, /*skip_first */
- 1, /*obj_hidefileno */
- " "H5_PRINTF_HADDR_FMT, /*obj_format */
+ 1, /*obj_hidefileno */
+ " " H5_PRINTF_HADDR_FMT, /*obj_format */
- 1, /*dset_hidefileno */
- "DATASET %s ", /*dset_format */
- "%s", /*dset_blockformat_pre */
- "%s", /*dset_ptformat_pre */
- "%s", /*dset_ptformat */
- 0, /*array indices */
- 0 /*escape non printable characters */
+ 1, /*dset_hidefileno */
+ "DATASET %s ", /*dset_format */
+ "%s", /*dset_blockformat_pre */
+ "%s", /*dset_ptformat_pre */
+ "%s", /*dset_ptformat */
+ 0, /*array indices */
+ 0 /*escape non printable characters */
};
-
/* internal functions */
-static int xml_name_to_XID(const char *, char *, int , int );
+static int xml_name_to_XID(const char *, char *, int, int);
/* internal functions used by XML option */
-static void xml_print_datatype(hid_t, unsigned);
-static void xml_print_enum(hid_t);
-static int xml_print_refs(hid_t, int);
-static int xml_print_strs(hid_t, int);
-static char *xml_escape_the_string(const char *, int);
-static char *xml_escape_the_name(const char *);
+static void xml_print_datatype(hid_t, unsigned);
+static void xml_print_enum(hid_t);
+static int xml_print_refs(hid_t, int);
+static int xml_print_strs(hid_t, int);
+static char *xml_escape_the_string(const char *, int);
+static char *xml_escape_the_name(const char *);
/*-------------------------------------------------------------------------
* Function: xml_dump_all_cb
@@ -133,41 +133,41 @@ static herr_t
xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
{
hid_t obj;
- herr_t ret = SUCCEED;
- char *obj_path = NULL; /* Full path of object */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ herr_t ret = SUCCEED;
+ char * obj_path = NULL; /* Full path of object */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
- string_dataformat.line_ncols = 65535;
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
/* Build the object's path name */
obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
- if(!obj_path) {
+ if (!obj_path) {
ret = FAIL;
goto done;
}
@@ -176,354 +176,361 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
HDstrcat(obj_path, "/");
HDstrcat(obj_path, name);
- if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ if (linfo->type == H5L_TYPE_HARD) {
+ H5O_info_t oinfo;
/* Stat the object */
- if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("unable to get object information for \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
goto done;
} /* end if */
- switch(oinfo.type) {
- case H5O_TYPE_GROUP:
- if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
- error_msg("unable to dump group \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- char *old_prefix; /* Pointer to previous prefix */
-
- /* Keep copy of prefix before iterating into group */
- if((old_prefix = HDstrdup(prefix)) == NULL) {
- error_msg("unable to allocate buffer\n");
+ switch (oinfo.type) {
+ case H5O_TYPE_GROUP:
+ if ((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump group \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- /* Append group name to prefix */
- add_prefix(&prefix, &prefix_len, name);
-
- /* Iterate into group */
- dump_function_table->dump_group_function(obj, name);
-
- /* Restore old prefix name */
- HDstrcpy(prefix, old_prefix);
- HDfree(old_prefix);
- }
-
- /* Close group */
- H5Gclose(obj);
- }
- break;
-
- case H5O_TYPE_DATASET:
- if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) {
- if(oinfo.rc > 1 || hit_elink) {
- obj_t *found_obj; /* Found object */
-
- found_obj = search_obj(dset_table, oinfo.addr);
-
- if(found_obj == NULL) {
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s \"%s\" %s",
- h5tools_dump_header_format->datasetbegin, name,
- h5tools_dump_header_format->datasetblockbegin);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetblockend);
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, " ");
- }
- if(HDstrlen(h5tools_dump_header_format->datasetend))
- h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level--;
+ char *old_prefix; /* Pointer to previous prefix */
+ /* Keep copy of prefix before iterating into group */
+ if ((old_prefix = HDstrdup(prefix)) == NULL) {
+ error_msg("unable to allocate buffer\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- H5Dclose(obj);
- goto done;
}
- else if(found_obj->displayed) {
- /* the XML version */
- char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
- char *t_name = xml_escape_the_name(name);
- char *t_objname = xml_escape_the_name(found_obj->objname);
- char dsetxid[100];
- char parentxid[100];
- char pointerxid[100];
-
- /* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" "
- "H5Path=\"%s\" Parents=\"%s\" "
- "H5ParentPaths=\"%s\">",
- xmlnsprefix,
- t_name, /* Dataset Name */
- dsetxid, get_next_xid(), /* OBJ-XID */
- t_obj_path, /* H5Path */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
-
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>",
- xmlnsprefix,
- pointerxid,t_objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.indent_level--;
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ else {
+ /* Append group name to prefix */
+ add_prefix(&prefix, &prefix_len, name);
- HDfree(t_name);
- HDfree(t_obj_path);
- HDfree(t_prefix);
- HDfree(t_objname);
+ /* Iterate into group */
+ dump_function_table->dump_group_function(obj, name);
- H5Dclose(obj);
- goto done;
+ /* Restore old prefix name */
+ HDstrcpy(prefix, old_prefix);
+ HDfree(old_prefix);
}
- else
- found_obj->displayed = TRUE;
- } /* end if */
- dump_function_table->dump_dataset_function(obj, name, NULL);
- H5Dclose(obj);
- }
- else {
- error_msg("unable to dump dataset \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- break;
+ /* Close group */
+ H5Gclose(obj);
+ }
+ break;
- case H5O_TYPE_NAMED_DATATYPE:
- if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
- error_msg("unable to dump datatype \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- dump_function_table->dump_named_datatype_function(obj, name);
- H5Tclose(obj);
- }
- break;
+ case H5O_TYPE_DATASET:
+ if ((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) {
+ if (oinfo.rc > 1 || hit_elink) {
+ obj_t *found_obj; /* Found object */
+
+ found_obj = search_obj(dset_table, oinfo.addr);
+
+ if (found_obj == NULL) {
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "%s \"%s\" %s",
+ h5tools_dump_header_format->datasetbegin, name,
+ h5tools_dump_header_format->datasetblockbegin);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ if (HDstrlen(h5tools_dump_header_format->datasetblockend)) {
+ h5tools_str_append(&buffer, "%s",
+ h5tools_dump_header_format->datasetblockend);
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, " ");
+ }
+ if (HDstrlen(h5tools_dump_header_format->datasetend))
+ h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ H5Dclose(obj);
+ goto done;
+ }
+ else if (found_obj->displayed) {
+ /* the XML version */
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char *t_objname = xml_escape_the_name(found_obj->objname);
+ char dsetxid[100];
+ char parentxid[100];
+ char pointerxid[100];
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1);
+ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sDataset Name=\"%s\" OBJ-XID=\"%s-%d\" "
+ "H5Path=\"%s\" Parents=\"%s\" "
+ "H5ParentPaths=\"%s\">",
+ xmlnsprefix, t_name, /* Dataset Name */
+ dsetxid, get_next_xid(), /* OBJ-XID */
+ t_obj_path, /* H5Path */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
+
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>",
+ xmlnsprefix, pointerxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_name);
+ HDfree(t_obj_path);
+ HDfree(t_prefix);
+ HDfree(t_objname);
+
+ H5Dclose(obj);
+ goto done;
+ }
+ else
+ found_obj->displayed = TRUE;
+ } /* end if */
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- error_msg("unknown object \"%s\"\n", name);
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- } /* end if */
- else {
- char *targbuf;
+ dump_function_table->dump_dataset_function(obj, name, NULL);
+ H5Dclose(obj);
+ }
+ else {
+ error_msg("unable to dump dataset \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ break;
- switch(linfo->type) {
- case H5L_TYPE_SOFT:
- if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
- error_msg("unable to allocate buffer\n");
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg("unable to get link value\n");
+ case H5O_TYPE_NAMED_DATATYPE:
+ if ((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
+ error_msg("unable to dump datatype \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else {
- /* print the value of a soft link */
- /* XML */
- char linkxid[100];
- char parentxid[100];
- char targetxid[100];
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
- char *t_name = xml_escape_the_name(name);
- char *t_targbuf = xml_escape_the_name(targbuf);
- char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_link_path;
- int res;
-
- t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1);
- if(targbuf[0] == '/')
- HDstrcpy(t_link_path, targbuf);
- else {
- HDstrcpy(t_link_path, prefix);
- HDstrcat(HDstrcat(t_link_path, "/"), targbuf);
- } /* end else */
-
- /* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
-
- /* Try to create an OBJ-XID for the object pointed to */
- res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0);
- if (res == 0) {
- /* target obj found */
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetPath=\"%s\" TargetObj=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- t_targbuf, /* TargetPath */
- targetxid, /* TargetObj */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
- /* dangling link -- omit from xml attributes */
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sSoftLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetPath=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- t_targbuf, /* TargetPath */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
-
- HDfree(t_prefix);
- HDfree(t_name);
- HDfree(t_targbuf);
- HDfree(t_obj_path);
- HDfree(t_link_path);
+ dump_function_table->dump_named_datatype_function(obj, name);
+ H5Tclose(obj);
}
+ break;
- HDfree(targbuf);
- }
- break;
-
- case H5L_TYPE_EXTERNAL:
- if((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
- error_msg("unable to allocate buffer\n");
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ error_msg("unknown object \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- }
- else {
- if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg("unable to get external link value\n");
+ }
+ } /* end if */
+ else {
+ char *targbuf;
+
+ switch (linfo->type) {
+ case H5L_TYPE_SOFT:
+ if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- } /* end if */
+ }
else {
- const char *filename;
- const char *targname;
-
- if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
- error_msg("unable to unpack external link value\n");
+ if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get link value\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- } /* end if */
+ }
else {
- char linkxid[100];
- char parentxid[100];
- char *t_name = xml_escape_the_name(name);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ /* print the value of a soft link */
+ /* XML */
+ char linkxid[100];
+ char parentxid[100];
+ char targetxid[100];
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/");
+ char *t_name = xml_escape_the_name(name);
+ char *t_targbuf = xml_escape_the_name(targbuf);
char *t_obj_path = xml_escape_the_name(obj_path);
- char *t_filename = xml_escape_the_name(filename);
- char *t_targname = xml_escape_the_name(targname);
+ char *t_link_path;
+ int res;
+
+ t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1);
+ if (targbuf[0] == '/')
+ HDstrcpy(t_link_path, targbuf);
+ else {
+ HDstrcpy(t_link_path, prefix);
+ HDstrcat(HDstrcat(t_link_path, "/"), targbuf);
+ } /* end else */
/* Create OBJ-XIDs for the parent and object */
xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sExternalLink LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "TargetFilename=\"%s\" "
- "TargetPath=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- filename, /* TargetFilename */
- targname, /* TargetPath*/
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Try to create an OBJ-XID for the object pointed to */
+ res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0);
+ if (res == 0) {
+ /* target obj found */
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetPath=\"%s\" TargetObj=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ targetxid, /* TargetObj */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ /* dangling link -- omit from xml attributes */
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sSoftLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ t_targbuf, /* TargetPath */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
HDfree(t_prefix);
HDfree(t_name);
- HDfree(t_filename);
- HDfree(t_targname);
+ HDfree(t_targbuf);
HDfree(t_obj_path);
- } /* end else */
- } /* end else */
- HDfree(targbuf);
- }
- break;
+ HDfree(t_link_path);
+ }
- case H5L_TYPE_ERROR:
- case H5L_TYPE_MAX:
- case H5L_TYPE_HARD:
- default:
- {
- char linkxid[100];
- char parentxid[100];
- char *t_name = xml_escape_the_name(name);
- char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/");
+ HDfree(targbuf);
+ }
+ break;
+
+ case H5L_TYPE_EXTERNAL:
+ if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) {
+ error_msg("unable to allocate buffer\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ if (H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
+ error_msg("unable to get external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ const char *filename;
+ const char *targname;
+
+ if (H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
+ error_msg("unable to unpack external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ } /* end if */
+ else {
+ char linkxid[100];
+ char parentxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/");
+ char *t_obj_path = xml_escape_the_name(obj_path);
+ char *t_filename = xml_escape_the_name(filename);
+ char *t_targname = xml_escape_the_name(targname);
+
+ /* Create OBJ-XIDs for the parent and object */
+ xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sExternalLink LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "TargetFilename=\"%s\" "
+ "TargetPath=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ filename, /* TargetFilename */
+ targname, /* TargetPath*/
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ HDfree(t_prefix);
+ HDfree(t_name);
+ HDfree(t_filename);
+ HDfree(t_targname);
+ HDfree(t_obj_path);
+ } /* end else */
+ } /* end else */
+ HDfree(targbuf);
+ }
+ break;
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default: {
+ char linkxid[100];
+ char parentxid[100];
+ char *t_name = xml_escape_the_name(name);
+ char *t_prefix = xml_escape_the_name(HDstrcmp(prefix, "") ? prefix : "/");
char *t_obj_path = xml_escape_the_name(obj_path);
/* Create OBJ-XIDs for the parent and object */
@@ -534,34 +541,34 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sUserDefined LinkName=\"%s\" "
- "OBJ-XID=\"%s\" "
- "H5SourcePath=\"%s\" "
- "LinkClass=\"%d\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- t_name, /* LinkName */
- linkxid, /* OBJ-XID */
- t_obj_path, /* H5SourcePath */
- linfo->type, /* LinkClass */
- parentxid, /* Parents */
- t_prefix); /* H5ParentPaths */
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sUserDefined LinkName=\"%s\" "
+ "OBJ-XID=\"%s\" "
+ "H5SourcePath=\"%s\" "
+ "LinkClass=\"%d\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, t_name, /* LinkName */
+ linkxid, /* OBJ-XID */
+ t_obj_path, /* H5SourcePath */
+ linfo->type, /* LinkClass */
+ parentxid, /* Parents */
+ t_prefix); /* H5ParentPaths */
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_prefix);
HDfree(t_name);
HDfree(t_obj_path);
- }
- break;
+ } break;
} /* end switch */
- } /* end else */
+ } /* end else */
done:
h5tools_str_close(&buffer);
- if(obj_path)
+ if (obj_path)
HDfree(obj_path);
return ret;
}
@@ -574,11 +581,12 @@ done:
* 1 - generate a fake entry and return fake id.
*/
int
-xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
+xml_name_to_XID(const char *str, char *outstr, int outlen, int gen)
{
- haddr_t objno; /* Object ID for object at path */
+ haddr_t objno; /* Object ID for object at path */
- if (outlen < 22) return 1;
+ if (outlen < 22)
+ return 1;
objno = ref_path_table_lookup(str);
if (objno == HADDR_UNDEF) {
@@ -587,7 +595,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
if (objno == HADDR_UNDEF) {
if (gen) {
objno = ref_path_table_gen_fake(str);
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ HDsprintf(outstr, "xid_" H5_PRINTF_HADDR_FMT, objno);
return 0;
}
else {
@@ -598,7 +606,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
else {
if (gen) {
objno = ref_path_table_gen_fake(str);
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ HDsprintf(outstr, "xid_" H5_PRINTF_HADDR_FMT, objno);
return 0;
}
else {
@@ -607,16 +615,16 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
}
}
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ HDsprintf(outstr, "xid_" H5_PRINTF_HADDR_FMT, objno);
return 0;
}
-static const char *quote = "&quot;";
-static const char *amp = "&amp;";
-static const char *lt = "&lt;";
-static const char *gt = "&gt;";
-static const char *apos = "&apos;";
+static const char *quote = "&quot;";
+static const char *amp = "&amp;";
+static const char *lt = "&lt;";
+static const char *gt = "&gt;";
+static const char *apos = "&apos;";
/*-------------------------------------------------------------------------
* Function: xml_escape_the_name
@@ -629,22 +637,22 @@ static const char *apos = "&apos;";
* Programmer: REMcG
*-------------------------------------------------------------------------
*/
-static char *
+static char *
xml_escape_the_name(const char *str)
{
size_t extra;
size_t len;
size_t i;
const char *cp;
- char *ncp;
- char *rcp;
+ char * ncp;
+ char * rcp;
size_t ncp_len;
if (!str)
return NULL;
- cp = str;
- len = HDstrlen(str);
+ cp = str;
+ len = HDstrlen(str);
extra = 0;
for (i = 0; i < len; i++) {
@@ -665,12 +673,12 @@ xml_escape_the_name(const char *str)
if (extra == 0)
return HDstrdup(str);
- cp = str;
+ cp = str;
ncp_len = len + extra + 1;
rcp = ncp = (char *)HDmalloc(ncp_len);
if (!ncp)
- return NULL; /* ?? */
+ return NULL; /* ?? */
for (i = 0; i < len; i++) {
size_t esc_len;
@@ -696,7 +704,7 @@ xml_escape_the_name(const char *str)
esc_len = HDstrlen(amp);
}
else {
- *ncp = *cp;
+ *ncp = *cp;
esc_len = 1;
}
ncp += esc_len;
@@ -725,9 +733,9 @@ xml_escape_the_string(const char *str, int slen)
size_t extra;
size_t len;
size_t i;
- const char *cp = NULL;
- char *ncp = NULL;
- char *rcp = NULL;
+ const char *cp = NULL;
+ char * ncp = NULL;
+ char * rcp = NULL;
size_t ncp_len;
if (!str)
@@ -758,9 +766,9 @@ xml_escape_the_string(const char *str, int slen)
cp++;
}
- cp = str;
+ cp = str;
ncp_len = len + extra + 1;
- rcp = ncp = (char *) HDcalloc(ncp_len, sizeof(char));
+ rcp = ncp = (char *)HDcalloc(ncp_len, sizeof(char));
if (ncp == NULL)
return NULL; /* ?? */
@@ -771,13 +779,13 @@ xml_escape_the_string(const char *str, int slen)
if (*cp == '\\') {
*ncp++ = '\\';
ncp_len--;
- *ncp = *cp;
+ *ncp = *cp;
esc_len = 1;
}
else if (*cp == '\"') {
*ncp++ = '\\';
ncp_len--;
- *ncp = *cp;
+ *ncp = *cp;
esc_len = 1;
}
else if (*cp == '\'') {
@@ -797,7 +805,7 @@ xml_escape_the_string(const char *str, int slen)
esc_len = HDstrlen(amp);
}
else {
- *ncp = *cp;
+ *ncp = *cp;
esc_len = 1;
}
ncp += esc_len;
@@ -828,69 +836,69 @@ xml_escape_the_string(const char *str, int slen)
static void
xml_print_datatype(hid_t type, unsigned in_group)
{
- char *mname;
- hid_t mtype;
- unsigned nmembers;
- unsigned ndims;
- unsigned i;
- size_t size;
- hsize_t dims[H5DUMP_MAX_RANK];
- H5T_str_t str_pad;
- H5T_cset_t cset;
- hid_t super;
- H5T_order_t ord;
- H5T_sign_t sgn;
- size_t sz;
- size_t spos;
- size_t epos;
- size_t esize;
- size_t mpos;
- size_t msize;
- int nmembs;
- htri_t is_vlstr = FALSE;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ char * mname;
+ hid_t mtype;
+ unsigned nmembers;
+ unsigned ndims;
+ unsigned i;
+ size_t size;
+ hsize_t dims[H5DUMP_MAX_RANK];
+ H5T_str_t str_pad;
+ H5T_cset_t cset;
+ hid_t super;
+ H5T_order_t ord;
+ H5T_sign_t sgn;
+ size_t sz;
+ size_t spos;
+ size_t epos;
+ size_t esize;
+ size_t mpos;
+ size_t msize;
+ int nmembs;
+ htri_t is_vlstr = FALSE;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
- string_dataformat.line_ncols = 65535;
+ if (h5tools_nCols == 0) {
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
- if(!in_group && H5Tcommitted(type) > 0) {
+ if (!in_group && H5Tcommitted(type) > 0) {
H5O_info_t oinfo;
- obj_t *found_obj; /* Found object */
+ obj_t * found_obj; /* Found object */
/* detect a shared datatype, output only once */
H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
found_obj = search_obj(type_table, oinfo.addr);
- if(found_obj) {
+ if (found_obj) {
/* This should be defined somewhere else */
/* These 2 cases are handled the same right now, but
probably will have something different eventually */
- char * dtxid = (char *)HDmalloc((size_t)100);
+ char *dtxid = (char *)HDmalloc((size_t)100);
xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
@@ -901,9 +909,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>",
- xmlnsprefix, dtxid);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>", xmlnsprefix, dtxid);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
/* point to the NDT by name */
@@ -913,9 +921,10 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>",
- xmlnsprefix, dtxid, t_objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix,
+ dtxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
}
HDfree(dtxid);
@@ -926,7 +935,8 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- h5dump error: unknown committed type. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_setstatus(EXIT_FAILURE);
}
}
@@ -937,8 +947,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
/* <hdf5:IntegerType ByteOrder="bo" Sign="torf" Size="bytes"/> */
@@ -949,7 +960,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"", xmlnsprefix);
switch (ord) {
case H5T_ORDER_LE:
h5tools_str_append(&buffer, "LE");
@@ -986,15 +997,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
sz = H5Tget_size(type);
h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
h5tools_str_append(&buffer, "\" />");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_FLOAT:
@@ -1008,15 +1021,16 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"", xmlnsprefix);
switch (ord) {
case H5T_ORDER_LE:
@@ -1040,17 +1054,21 @@ xml_print_datatype(hid_t type, unsigned in_group)
h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize);
h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos);
- h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos);
- h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ",
+ (unsigned long)esize, (unsigned long)epos);
+ h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />",
+ (unsigned long)msize, (unsigned long)mpos);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_TIME:
@@ -1058,16 +1076,18 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sTimeType />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_append(&buffer, "<!-- H5T_TIME: not yet implemented -->");
ctx.indent_level--;
@@ -1075,23 +1095,25 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_STRING:
/* <hdf5:StringType Cset="cs" StrSize="chars" StrPad="pad" /> */
- size = H5Tget_size(type);
- str_pad = H5Tget_strpad(type);
- cset = H5Tget_cset(type);
+ size = H5Tget_size(type);
+ str_pad = H5Tget_strpad(type);
+ cset = H5Tget_cset(type);
is_vlstr = H5Tis_variable_str(type);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
@@ -1099,17 +1121,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sStringType Cset=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sStringType Cset=\"", xmlnsprefix);
if (cset == H5T_CSET_ASCII)
h5tools_str_append(&buffer, "H5T_CSET_ASCII\" ");
else
h5tools_str_append(&buffer, "unknown_cset\" ");
- if(is_vlstr)
+ if (is_vlstr)
h5tools_str_append(&buffer, "StrSize=\"H5T_VARIABLE\" StrPad=\"");
else
- h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int) size);
+ h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int)size);
if (str_pad == H5T_STR_NULLTERM)
h5tools_str_append(&buffer, "H5T_STR_NULLTERM\"/>");
@@ -1119,15 +1141,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
h5tools_str_append(&buffer, "H5T_STR_SPACEPAD\"/>");
else
h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_BITFIELD:
@@ -1138,15 +1162,16 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"", xmlnsprefix);
switch (ord) {
case H5T_ORDER_LE:
@@ -1165,15 +1190,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
size = H5Tget_size(type);
h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_OPAQUE:
@@ -1183,8 +1210,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
mname = H5Tget_tag(type);
@@ -1192,19 +1220,21 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname);
+ h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ", xmlnsprefix, mname);
H5free_memory(mname);
size = H5Tget_size(type);
h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_COMPOUND:
@@ -1217,8 +1247,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sCompoundType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* List each member Field of the type */
/* <hdf5:Field FieldName="name" > */
@@ -1228,16 +1259,17 @@ xml_print_datatype(hid_t type, unsigned in_group)
for (i = 0; i < nmembers; i++) {
char *t_fname;
- mname = H5Tget_member_name(type, i);
- mtype = H5Tget_member_type(type, i);
+ mname = H5Tget_member_name(type, i);
+ mtype = H5Tget_member_type(type, i);
t_fname = xml_escape_the_name(mname);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">", xmlnsprefix, t_fname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
H5free_memory(mname);
HDfree(t_fname);
@@ -1248,11 +1280,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
- xml_print_datatype(mtype,0);
+ xml_print_datatype(mtype, 0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1260,8 +1293,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1269,8 +1303,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sField>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sField>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
dump_indent -= COL;
ctx.indent_level--;
@@ -1279,8 +1314,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sCompoundType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sCompoundType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_REFERENCE:
@@ -1288,8 +1324,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
/* Only Object references supported at this time */
@@ -1297,32 +1334,36 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sReferenceType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sObjectReferenceType />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sReferenceType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sReferenceType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_ENUM:
@@ -1333,8 +1374,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent += COL;
ctx.indent_level++;
@@ -1342,16 +1384,18 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">", xmlnsprefix, nmembs);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
xml_print_enum(type);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sEnumType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sEnumType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1359,8 +1403,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sAtomicType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
break;
case H5T_VLEN:
@@ -1368,8 +1413,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sVLType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
super = H5Tget_super(type);
dump_indent += COL;
ctx.indent_level++;
@@ -1378,11 +1424,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent += COL;
ctx.indent_level++;
- xml_print_datatype(super,0);
+ xml_print_datatype(super, 0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1390,8 +1437,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1399,8 +1447,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sVLType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sVLType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
H5Tclose(super);
break;
@@ -1414,10 +1463,11 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sArrayType Ndims=\"",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sArrayType Ndims=\"", xmlnsprefix);
ndims = (unsigned)H5Tget_array_ndims(type);
h5tools_str_append(&buffer, "%u\">", ndims);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* Get array information */
H5Tget_array_dims2(type, dims);
@@ -1429,8 +1479,10 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix,
+ (int)dims[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
@@ -1441,11 +1493,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent += COL;
ctx.indent_level++;
- xml_print_datatype(super,0);
+ xml_print_datatype(super, 0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1453,8 +1506,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
dump_indent -= COL;
ctx.indent_level--;
@@ -1462,8 +1516,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sArrayType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sArrayType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* Close array base type */
H5Tclose(super);
break;
@@ -1476,7 +1531,8 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- unknown datatype -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_setstatus(EXIT_FAILURE);
break;
}
@@ -1498,48 +1554,48 @@ xml_print_datatype(hid_t type, unsigned in_group)
void
xml_dump_datatype(hid_t type)
{
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.indent_level++;
dump_indent += COL;
- if(H5Tcommitted(type) > 0) {
+ if (H5Tcommitted(type) > 0) {
H5O_info_t oinfo;
- obj_t *found_obj; /* Found object */
+ obj_t * found_obj; /* Found object */
/* Datatype is a shared or named datatype */
H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
found_obj = search_obj(type_table, oinfo.addr);
- if(found_obj) {
+ if (found_obj) {
/* Shared datatype, must be entered as an object */
/* These 2 cases are the same now, but may change */
char *dtxid = (char *)HDmalloc((size_t)100);
@@ -1556,9 +1612,9 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>",
- xmlnsprefix, dtxid);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>", xmlnsprefix, dtxid);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
/* pointer to a named datatype already in XML */
@@ -1569,8 +1625,9 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\" H5Path=\"%s\" />",
- xmlnsprefix, dtxid, t_objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ xmlnsprefix, dtxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
}
HDfree(dtxid);
@@ -1581,7 +1638,8 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- h5dump error: unknown committed type. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
}
else {
@@ -1590,7 +1648,8 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
xml_print_datatype(type, 0);
@@ -1602,7 +1661,8 @@ xml_dump_datatype(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
dump_indent -= COL;
@@ -1626,38 +1686,38 @@ xml_dump_dataspace(hid_t space)
hsize_t size[H5DUMP_MAX_RANK];
hsize_t maxsize[H5DUMP_MAX_RANK];
int i;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
- int ndims = H5Sget_simple_extent_dims(space, size, maxsize);
- H5S_class_t space_type = H5Sget_simple_extent_type(space);
+ int ndims = H5Sget_simple_extent_dims(space, size, maxsize);
+ H5S_class_t space_type = H5Sget_simple_extent_type(space);
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.indent_level++;
@@ -1666,96 +1726,111 @@ xml_dump_dataspace(hid_t space)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataspace>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
switch (space_type) {
- case H5S_SCALAR:
- /* scalar dataspace (just a tag, no XML attrs. defined */
+ case H5S_SCALAR:
+ /* scalar dataspace (just a tag, no XML attrs. defined */
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sScalarDataspace />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sScalarDataspace />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
- case H5S_SIMPLE:
- /* simple dataspace */
- /* <hdf5:SimpleDataspace Ndims="nd"> */
+ case H5S_SIMPLE:
+ /* simple dataspace */
+ /* <hdf5:SimpleDataspace Ndims="nd"> */
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">",xmlnsprefix, ndims);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sSimpleDataspace Ndims=\"%d\">", xmlnsprefix, ndims);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* print the <hdf5:Dimension> elements */
- ctx.indent_level++;
- for (i = 0; i < ndims; i++) {
- if (maxsize[i] == H5S_UNLIMITED) {
- ctx.need_prefix = TRUE;
+ /* print the <hdf5:Dimension> elements */
+ ctx.indent_level++;
+ for (i = 0; i < ndims; i++) {
+ if (maxsize[i] == H5S_UNLIMITED) {
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"UNLIMITED\"/>",
- xmlnsprefix,size[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else if (maxsize[i] == (hsize_t) 0) {
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
+ "u\" MaxDimSize=\"UNLIMITED\"/>",
+ xmlnsprefix, size[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else if (maxsize[i] == (hsize_t)0) {
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
- xmlnsprefix,size[i], size[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
+ "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
+ xmlnsprefix, size[i], size[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
- xmlnsprefix, size[i], maxsize[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer,
+ "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
+ "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
+ xmlnsprefix, size[i], maxsize[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
}
- }
- ctx.indent_level--;
+ ctx.indent_level--;
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sSimpleDataspace>", xmlnsprefix );
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sSimpleDataspace>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
#ifdef TMP
- /* Commented out: wait until the schema is updated first */
- case H5S_NULL:
- /* null dataspace (just a tag, no XML attrs. defined */
+ /* Commented out: wait until the schema is updated first */
+ case H5S_NULL:
+ /* null dataspace (just a tag, no XML attrs. defined */
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNullDataspace />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNullDataspace />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
#endif /* TMP */
- case H5S_NULL:
- case H5S_NO_CLASS:
- default:
- ctx.need_prefix = TRUE;
+ case H5S_NULL:
+ case H5S_NO_CLASS:
+ default:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- unknown dataspace -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- unknown dataspace -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
@@ -1765,7 +1840,8 @@ xml_dump_dataspace(hid_t space)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataspace>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
h5tools_str_close(&buffer);
@@ -1784,19 +1860,19 @@ xml_dump_dataspace(hid_t space)
void
xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset, int H5_ATTR_UNUSED pindex)
{
- hid_t space = H5I_INVALID_HID;
- hid_t type = H5I_INVALID_HID;
- hid_t p_type = H5I_INVALID_HID;
- int status = -1;
- 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 = &xml_dataformat;
- h5tool_format_t string_dataformat;
+ hid_t space = H5I_INVALID_HID;
+ hid_t type = H5I_INVALID_HID;
+ hid_t p_type = H5I_INVALID_HID;
+ int status = -1;
+ 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 = &xml_dataformat;
+ h5tool_format_t string_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
/* Print all the values. */
/* setup */
@@ -1806,29 +1882,30 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.cmpd_sep = " ";
- string_dataformat.cmpd_pre = "";
- string_dataformat.cmpd_suf = "";
- string_dataformat.cmpd_end = "";
+ string_dataformat.cmpd_sep = " ";
+ string_dataformat.cmpd_pre = "";
+ string_dataformat.cmpd_suf = "";
+ string_dataformat.cmpd_end = "";
string_dataformat.arr_linebreak = 0;
- string_dataformat.arr_pre = "";
- outputformat = &string_dataformat;
+ string_dataformat.arr_pre = "";
+ outputformat = &string_dataformat;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
@@ -1837,7 +1914,8 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -1853,10 +1931,10 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
else {
h5tools_context_t datactx;
HDmemset(&datactx, 0, sizeof(datactx));
- datactx.need_prefix = TRUE;
+ datactx.need_prefix = TRUE;
datactx.indent_level = ctx.indent_level;
- datactx.cur_column = ctx.cur_column;
- status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id);
+ datactx.cur_column = ctx.cur_column;
+ status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id);
}
}
else {
@@ -1875,18 +1953,18 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
else if (H5Tget_class(type) == H5T_STRING) {
status = xml_print_strs(obj_id, ATTRIBUTE_DATA);
}
- else { /* all other data */
+ else { /* all other data */
space = H5Aget_space(obj_id);
- if(space == H5S_NULL || space == H5S_NO_CLASS) {
+ if (space == H5S_NULL || space == H5S_NO_CLASS) {
status = SUCCEED;
}
else {
h5tools_context_t datactx;
HDmemset(&datactx, 0, sizeof(datactx));
- datactx.need_prefix = TRUE;
+ datactx.need_prefix = TRUE;
datactx.indent_level = ctx.indent_level;
- datactx.cur_column = ctx.cur_column;
- status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id);
+ datactx.cur_column = ctx.cur_column;
+ status = h5tools_dump_mem(rawoutstream, outputformat, &datactx, obj_id);
}
H5Tclose(p_type);
H5Sclose(space);
@@ -1902,7 +1980,8 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "Unable to print data.");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -1917,8 +1996,9 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -1927,7 +2007,8 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -1944,16 +2025,16 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset,
*/
herr_t
xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info,
- void H5_ATTR_UNUSED * op_data)
+ void H5_ATTR_UNUSED *op_data)
{
hid_t attr_id = H5I_INVALID_HID;
- hid_t type = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
H5S_class_t space_type;
- 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 = &xml_dataformat;
+ 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 = &xml_dataformat;
h5tool_format_t string_dataformat;
char *t_aname = xml_escape_the_name(attr_name);
@@ -1963,36 +2044,37 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sAttribute Name=\"%s\">", xmlnsprefix, t_aname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_aname);
if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) {
- type = H5Aget_type(attr_id);
- space = H5Aget_space(attr_id);
+ type = H5Aget_type(attr_id);
+ space = H5Aget_space(attr_id);
space_type = H5Sget_simple_extent_type(space);
dump_function_table->dump_dataspace_function(space);
@@ -2003,158 +2085,175 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
if (dump_opts.display_attr_data && space_type != H5S_NULL) {
switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_ENUM:
- case H5T_ARRAY:
- dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
- break;
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
+
+ case H5T_TIME:
+ ctx.indent_level++;
+ dump_indent += COL;
- case H5T_TIME:
- ctx.indent_level++;
- dump_indent += COL;
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<hdf5:Data>");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<hdf5:Data>");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
- ctx.indent_level--;
- dump_indent -= COL;
- break;
+ case H5T_COMPOUND:
+ ctx.need_prefix = TRUE;
- case H5T_COMPOUND:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
- break;
+ case H5T_REFERENCE:
+ ctx.need_prefix = TRUE;
- case H5T_REFERENCE:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_print_refs(attr_id, ATTRIBUTE_DATA);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_VLEN:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
+ h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
+ break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- xml_print_refs(attr_id, ATTRIBUTE_DATA);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
-
- case H5T_VLEN:
- ctx.need_prefix = TRUE;
+ h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- dump_function_table->dump_data_function(attr_id, ATTRIBUTE_DATA, NULL, 0);
- break;
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- default:
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
}
}
else {
@@ -2165,7 +2264,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
@@ -2174,7 +2274,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -2183,7 +2284,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
dump_indent -= COL;
@@ -2197,7 +2299,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
return SUCCEED;
@@ -2211,7 +2314,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- h5dump error: unable to open attribute. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -2220,7 +2324,8 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
@@ -2242,17 +2347,17 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
void
xml_dump_named_datatype(hid_t type, const char *name)
{
- 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 = &xml_dataformat;
+ 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 = &xml_dataformat;
h5tool_format_t string_dataformat;
- char *tmp;
- char *dtxid;
- char *parentxid;
- char *t_tmp;
- char *t_prefix;
- char *t_name;
+ char * tmp;
+ char * dtxid;
+ char * parentxid;
+ char * t_tmp;
+ char * t_prefix;
+ char * t_name;
tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
@@ -2264,34 +2369,34 @@ xml_dump_named_datatype(hid_t type, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
- dtxid = (char *)HDmalloc((size_t)100);
+ dtxid = (char *)HDmalloc((size_t)100);
parentxid = (char *)HDmalloc((size_t)100);
- t_tmp = xml_escape_the_name(tmp);
- t_prefix = xml_escape_the_name(prefix);
- t_name = xml_escape_the_name(name);
+ t_tmp = xml_escape_the_name(tmp);
+ t_prefix = xml_escape_the_name(prefix);
+ t_name = xml_escape_the_name(name);
xml_name_to_XID(tmp, dtxid, 100, 1);
xml_name_to_XID(prefix, parentxid, 100, 1);
- if(HDstrncmp(name, "#", (size_t)1) == 0) {
+ if (HDstrncmp(name, "#", (size_t)1) == 0) {
/* Special: this is an 'anonymous' NDT, deleted but
still in use.
We follow the dumper's undocumented practice, and
@@ -2305,31 +2410,32 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\">",
- xmlnsprefix,
- name, dtxid,
- parentxid, HDstrcmp(prefix,"") ? t_prefix : "/");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix, name, dtxid, parentxid, HDstrcmp(prefix, "") ? t_prefix : "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
- H5O_info_t oinfo; /* Object info */
+ H5O_info_t oinfo; /* Object info */
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
- "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">",
- xmlnsprefix,
- t_name, dtxid,
- t_tmp, parentxid, (HDstrcmp(prefix, "") ? t_prefix : "/"));
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
+ "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix, t_name, dtxid, t_tmp, parentxid,
+ (HDstrcmp(prefix, "") ? t_prefix : "/"));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* Check uniqueness of named datatype */
H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
- if(oinfo.rc > 1) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1) {
+ obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
found_obj = search_obj(type_table, oinfo.addr);
@@ -2340,11 +2446,11 @@ xml_dump_named_datatype(hid_t type, const char *name)
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- else if(found_obj->displayed) {
+ else if (found_obj->displayed) {
/* We have already printed this named datatype, print it as a
* NamedDatatypePtr
*/
- char pointerxid[100];
+ char pointerxid[100];
char *t_objname = xml_escape_the_name(found_obj->objname);
ctx.indent_level++;
@@ -2355,8 +2461,10 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, pointerxid, t_objname);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix,
+ pointerxid, t_objname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -2365,7 +2473,8 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sNamedDataType>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
goto done;
}
@@ -2381,12 +2490,13 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
- xml_print_datatype(type,1);
+ xml_print_datatype(type, 1);
ctx.indent_level--;
dump_indent -= COL;
@@ -2394,8 +2504,9 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -2404,8 +2515,9 @@ xml_dump_named_datatype(hid_t type, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sNamedDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sNamedDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
done:
@@ -2432,23 +2544,23 @@ done:
void
xml_dump_group(hid_t gid, const char *name)
{
- H5O_info_t oinfo;
- hid_t gcpl_id;
- hid_t dset, type;
- unsigned crt_order_flags;
- unsigned attr_crt_order_flags;
- int isRoot = 0;
- char type_name[1024];
- char *t_objname = NULL;
- char *par_name = NULL;
- char *cp = NULL;
- char *tmp = NULL;
- char *par = NULL;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ H5O_info_t oinfo;
+ hid_t gcpl_id;
+ hid_t dset, type;
+ unsigned crt_order_flags;
+ unsigned attr_crt_order_flags;
+ int isRoot = 0;
+ char type_name[1024];
+ char * t_objname = NULL;
+ char * par_name = NULL;
+ char * cp = NULL;
+ char * tmp = NULL;
+ char * par = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
error_msg("error in getting group creation property list ID\n");
@@ -2462,12 +2574,12 @@ xml_dump_group(hid_t gid, const char *name)
}
/* query the group creation properties */
- if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
+ if (H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) {
error_msg("error in getting group creation properties\n");
h5tools_setstatus(EXIT_FAILURE);
}
- if(H5Pclose(gcpl_id) < 0) {
+ if (H5Pclose(gcpl_id) < 0) {
error_msg("error in closing group creation property list ID\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -2477,36 +2589,36 @@ xml_dump_group(hid_t gid, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
- if(HDstrcmp(name, "/") == 0) {
+ if (HDstrcmp(name, "/") == 0) {
isRoot = 1;
- tmp = HDstrdup("/");
+ tmp = HDstrdup("/");
}
else {
tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
par = HDstrdup(tmp);
- cp = HDstrrchr(par, '/');
- if(cp) {
- if((cp == par) && HDstrlen(par) > 1)
+ cp = HDstrrchr(par, '/');
+ if (cp) {
+ if ((cp == par) && HDstrlen(par) > 1)
*(cp + 1) = '\0';
else
*cp = '\0';
@@ -2515,8 +2627,8 @@ xml_dump_group(hid_t gid, const char *name)
H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC);
- if(oinfo.rc > 1) {
- obj_t *found_obj; /* Found object */
+ if (oinfo.rc > 1) {
+ obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
found_obj = search_obj(group_table, oinfo.addr);
@@ -2527,15 +2639,15 @@ xml_dump_group(hid_t gid, const char *name)
h5tools_setstatus(EXIT_FAILURE);
}
else {
- char *t_name = xml_escape_the_name(name);
- char *grpxid = (char *)HDmalloc((size_t)100);
+ char *t_name = xml_escape_the_name(name);
+ char *grpxid = (char *)HDmalloc((size_t)100);
char *parentxid = (char *)HDmalloc((size_t)100);
- if(found_obj->displayed) {
+ if (found_obj->displayed) {
char *ptrstr = (char *)HDmalloc((size_t)100);
/* already seen: enter a groupptr */
- if(isRoot) {
+ if (isRoot) {
/* probably can't happen! */
xml_name_to_XID("/", grpxid, 100, 1);
@@ -2543,13 +2655,14 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">",
- xmlnsprefix, grpxid, "/");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix,
+ grpxid, "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
t_objname = xml_escape_the_name(found_obj->objname);
- par_name = xml_escape_the_name(par);
+ par_name = xml_escape_the_name(par);
xml_name_to_XID(tmp, grpxid, 100, 1);
xml_name_to_XID(par, parentxid, 100, 1);
@@ -2557,18 +2670,20 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\">",
- xmlnsprefix,t_name, grpxid, get_next_xid(),
- t_objname, parentxid, par_name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix, t_name, grpxid, get_next_xid(), t_objname, parentxid,
+ par_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
HDfree(par_name);
ctx.indent_level++;
- t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */
- par_name = xml_escape_the_name(par);
+ t_objname = xml_escape_the_name(found_obj->objname); /* point to the NDT by name */
+ par_name = xml_escape_the_name(par);
xml_name_to_XID(found_obj->objname, ptrstr, 100, 1);
xml_name_to_XID(par, parentxid, 100, 1);
@@ -2576,11 +2691,12 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" />",
- xmlnsprefix,
- ptrstr, t_objname, parentxid, par_name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sGroupPtr OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" />",
+ xmlnsprefix, ptrstr, t_objname, parentxid, par_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
@@ -2592,16 +2708,17 @@ xml_dump_group(hid_t gid, const char *name)
else {
/* first time this group has been seen -- describe it */
- if(isRoot) {
+ if (isRoot) {
xml_name_to_XID("/", grpxid, 100, 1);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">",
- xmlnsprefix, grpxid, "/");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix,
+ grpxid, "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
char *t_tmp = xml_escape_the_name(tmp);
@@ -2614,10 +2731,12 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" >",
- xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer,
+ "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" >",
+ xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_tmp);
HDfree(par_name);
@@ -2629,28 +2748,30 @@ xml_dump_group(hid_t gid, const char *name)
ctx.indent_level++;
dump_indent += COL;
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
- if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if (H5Aiterate2(gid, sort_by, sort_order, NULL,
+ dump_function_table->dump_attribute_function, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if (H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL,
+ dump_function_table->dump_attribute_function, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end else */
+ } /* end else */
- if(isRoot && unamedtype) {
+ if (isRoot && unamedtype) {
unsigned u;
/* Very special case: dump unamed type in root group */
- for(u = 0; u < type_table->nobjs; u++) {
- if(!type_table->objs[u].recorded) {
+ for (u = 0; u < type_table->nobjs; u++) {
+ if (!type_table->objs[u].recorded) {
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ HDsprintf(type_name, "#" H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2660,7 +2781,7 @@ xml_dump_group(hid_t gid, const char *name)
/* iterate through all the links */
- if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
else
H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
@@ -2675,8 +2796,8 @@ xml_dump_group(hid_t gid, const char *name)
}
else {
/* only link -- must be first time! */
- char *t_name = xml_escape_the_name(name);
- char *grpxid = (char *)HDmalloc((size_t)100);
+ char *t_name = xml_escape_the_name(name);
+ char *grpxid = (char *)HDmalloc((size_t)100);
char *parentxid = (char *)HDmalloc((size_t)100);
ctx.need_prefix = TRUE;
@@ -2684,9 +2805,10 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- if(isRoot) {
+ if (isRoot) {
xml_name_to_XID("/", grpxid, 100, 1);
- h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/");
+ h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid,
+ "/");
}
else {
char *t_tmp = xml_escape_the_name(tmp);
@@ -2694,13 +2816,15 @@ xml_dump_group(hid_t gid, const char *name)
par_name = xml_escape_the_name(par);
xml_name_to_XID(tmp, grpxid, 100, 1);
xml_name_to_XID(par, parentxid, 100, 1);
- h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
- "Parents=\"%s\" H5ParentPaths=\"%s\" >",
- xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
+ h5tools_str_append(&buffer,
+ "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
+ "Parents=\"%s\" H5ParentPaths=\"%s\" >",
+ xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
HDfree(t_tmp);
HDfree(par_name);
}
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_name);
HDfree(grpxid);
@@ -2711,28 +2835,30 @@ xml_dump_group(hid_t gid, const char *name)
ctx.indent_level++;
dump_indent += COL;
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
- if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if (H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function,
+ NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if (H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL,
+ dump_function_table->dump_attribute_function, NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end else */
+ } /* end else */
- if(isRoot && unamedtype) {
+ if (isRoot && unamedtype) {
unsigned u;
/* Very special case: dump unamed type in root group */
- for(u = 0; u < type_table->nobjs; u++) {
- if(!type_table->objs[u].recorded) {
+ for (u = 0; u < type_table->nobjs; u++) {
+ if (!type_table->objs[u].recorded) {
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+ HDsprintf(type_name, "#" H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2742,7 +2868,7 @@ xml_dump_group(hid_t gid, const char *name)
/* iterate through all the links */
- if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
+ if ((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
else
H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
@@ -2755,17 +2881,18 @@ xml_dump_group(hid_t gid, const char *name)
/* Render the element */
h5tools_str_reset(&buffer);
- if(isRoot)
+ if (isRoot)
h5tools_str_append(&buffer, "</%sRootGroup>", xmlnsprefix);
else
h5tools_str_append(&buffer, "</%sGroup>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
- if(par)
+ if (par)
HDfree(par);
- if(tmp)
+ if (tmp)
HDfree(tmp);
}
@@ -2783,18 +2910,18 @@ static int
xml_print_refs(hid_t did, int source)
{
herr_t e;
- hid_t type = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hssize_t ssiz = -1;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hssize_t ssiz = -1;
hsize_t i;
size_t tsiz;
- hobj_ref_t *refbuf = NULL;
- char *buf = NULL;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ hobj_ref_t * refbuf = NULL;
+ char * buf = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
if (source == DATASET_DATA) {
type = H5Dget_type(did);
@@ -2822,7 +2949,7 @@ xml_print_refs(hid_t did, int source)
if ((tsiz = H5Tget_size(type)) == 0)
goto error;
- buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ buf = (char *)HDcalloc((size_t)ssiz, tsiz);
if (buf == NULL)
goto error;
e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
@@ -2837,7 +2964,7 @@ xml_print_refs(hid_t did, int source)
if ((tsiz = H5Tget_size(type)) == 0)
goto error;
- buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ buf = (char *)HDcalloc((size_t)ssiz, tsiz);
if (buf == NULL)
goto error;
e = H5Aread(did, H5T_STD_REF_OBJ, buf);
@@ -2853,24 +2980,24 @@ xml_print_refs(hid_t did, int source)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
for (i = 0; i < (hsize_t)ssiz; i++) {
const char *path = lookup_ref_path(*refbuf);
@@ -2882,7 +3009,8 @@ xml_print_refs(hid_t did, int source)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", "NULL");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
char *t_path = xml_escape_the_string(path, -1);
@@ -2892,7 +3020,8 @@ xml_print_refs(hid_t did, int source)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", t_path);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_path);
}
ctx.indent_level--;
@@ -2908,13 +3037,15 @@ xml_print_refs(hid_t did, int source)
return SUCCEED;
error:
- if(buf)
+ if (buf)
HDfree(buf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(type);
H5Sclose(space);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
@@ -2932,21 +3063,21 @@ static int
xml_print_strs(hid_t did, int source)
{
herr_t e;
- hid_t type = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hssize_t ssiz = -1;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hssize_t ssiz = -1;
htri_t is_vlstr = FALSE;
- size_t tsiz = 0;
+ size_t tsiz = 0;
hsize_t i;
- size_t str_size = 0;
- char *bp = NULL;
- char *onestring = NULL;
- void *buf = NULL;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ size_t str_size = 0;
+ char * bp = NULL;
+ char * onestring = NULL;
+ void * buf = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
if (source == DATASET_DATA)
type = H5Dget_type(did);
@@ -2963,9 +3094,9 @@ xml_print_strs(hid_t did, int source)
if (source == DATASET_DATA) {
space = H5Dget_space(did);
- if((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
+ if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
goto error;
- if((tsiz = H5Tget_size(type)) == 0)
+ if ((tsiz = H5Tget_size(type)) == 0)
goto error;
buf = HDmalloc((size_t)ssiz * tsiz);
@@ -2978,9 +3109,9 @@ xml_print_strs(hid_t did, int source)
}
else if (source == ATTRIBUTE_DATA) {
space = H5Aget_space(did);
- if((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
+ if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
goto error;
- if((tsiz = H5Tget_size(type)) == 0)
+ if ((tsiz = H5Tget_size(type)) == 0)
goto error;
buf = HDmalloc((size_t)ssiz * tsiz);
@@ -2992,33 +3123,33 @@ xml_print_strs(hid_t did, int source)
goto error;
}
- bp = (char*) buf;
+ bp = (char *)buf;
if (!is_vlstr)
- onestring = (char *) HDcalloc(tsiz, sizeof(char));
+ onestring = (char *)HDcalloc(tsiz, sizeof(char));
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
for (i = 0; i < (hsize_t)ssiz; i++) {
if (is_vlstr) {
@@ -3037,7 +3168,8 @@ xml_print_strs(hid_t did, int source)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "NULL");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
char *t_onestring = xml_escape_the_string(onestring, (int)str_size);
@@ -3048,7 +3180,8 @@ xml_print_strs(hid_t did, int source)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", t_onestring);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_onestring);
}
}
@@ -3071,13 +3204,15 @@ xml_print_strs(hid_t did, int source)
return SUCCEED;
error:
- if(buf)
+ if (buf)
HDfree(buf);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(type);
H5Sclose(space);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
}
@@ -3102,41 +3237,42 @@ check_filters(hid_t dcpl)
size_t cd_nelmts = 20;
unsigned int cd_values[20];
unsigned int flags;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
nfilt = H5Pget_nfilters(dcpl);
if (nfilt <= 0)
return;
for (i = 0; i < nfilt; i++) {
- filter = H5Pget_filter2(dcpl, (unsigned) i, &flags, (size_t *) &cd_nelmts, cd_values, (size_t)120, namebuf, NULL);
+ filter = H5Pget_filter2(dcpl, (unsigned)i, &flags, (size_t *)&cd_nelmts, cd_values, (size_t)120,
+ namebuf, NULL);
if (filter == H5Z_FILTER_DEFLATE) {
ctx.indent_level++;
ctx.need_prefix = TRUE;
@@ -3152,7 +3288,8 @@ check_filters(hid_t dcpl)
h5tools_str_append(&buffer, "%d", cd_values[0]);
}
h5tools_str_append(&buffer, "\"/>");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else if (filter == H5Z_FILTER_FLETCHER32) {
@@ -3162,7 +3299,8 @@ check_filters(hid_t dcpl)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sFletcher32 />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else if (filter == H5Z_FILTER_SHUFFLE) {
@@ -3172,7 +3310,8 @@ check_filters(hid_t dcpl)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sShuffle />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else if (filter == H5Z_FILTER_SZIP) {
@@ -3219,7 +3358,8 @@ check_filters(hid_t dcpl)
h5tools_str_append(&buffer, "Header=\"Raw\"");
}
h5tools_str_append(&buffer, "/>");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else {
@@ -3236,37 +3376,37 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
size_t sz;
size_t i;
hsize_t space;
- void *buf;
- char *name;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
+ void * buf;
+ char * name;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
ctx.indent_level++;
dump_indent += COL;
@@ -3276,31 +3416,34 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
space = H5Tget_size(type);
- buf = HDmalloc((size_t) space);
+ buf = HDmalloc((size_t)space);
H5Pget_fill_value(dcpl, type, buf);
if (H5Tget_class(type) == H5T_REFERENCE) {
- const char * path = lookup_ref_path(*(hobj_ref_t *) buf);
+ const char *path = lookup_ref_path(*(hobj_ref_t *)buf);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
if (!path) {
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", "NULL");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
char *t_path = xml_escape_the_string(path, -1);
@@ -3310,7 +3453,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"%s\"", t_path);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_path);
}
@@ -3319,7 +3463,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else if (H5Tget_class(type) == H5T_STRING) {
/* ????? */
@@ -3328,197 +3473,221 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- String fill values not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
/* all other data */
switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- ctx.need_prefix = TRUE;
+ case H5T_INTEGER:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "\"%d\"", *(int *) buf);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%d\"", *(int *)buf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_FLOAT:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_FLOAT:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "\"%f\"", (double)*(float *)buf);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%f\"", (double)*(float *)buf);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- sz = H5Tget_size(type);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ sz = H5Tget_size(type);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "\"");
- for (i = 0; i < sz; i++) {
- h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf + (i * sizeof(unsigned int)));
- }
- h5tools_str_append(&buffer, "\"");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"");
+ for (i = 0; i < sz; i++) {
+ h5tools_str_append(&buffer, "%x ", *(unsigned int *)buf + (i * sizeof(unsigned int)));
+ }
+ h5tools_str_append(&buffer, "\"");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_ENUM:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_ENUM:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- name = H5Tget_member_name(type, *(unsigned *) buf);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ name = H5Tget_member_name(type, *(unsigned *)buf);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "\"%s\"", name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- if(name)
- H5free_memory(name);
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "\"%s\"", name);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (name)
+ H5free_memory(name);
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_ARRAY:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_ARRAY:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Array fill values not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Array fill values not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_TIME:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_TIME:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Time fill not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Time fill not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_COMPOUND:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_COMPOUND:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Compound fill not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Compound fill not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_VLEN:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_VLEN:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- VL fill not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- VL fill not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- case H5T_STRING:
- case H5T_REFERENCE:
- default:
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ case H5T_STRING:
+ case H5T_REFERENCE:
+ default:
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Unknown fill datatype: %d -->", H5Tget_class(type));
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Unknown fill datatype: %d -->", H5Tget_class(type));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
}
}
HDfree(buf);
@@ -3530,7 +3699,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -3548,32 +3718,32 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
void
xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *sset)
{
- hid_t type;
- hid_t space;
- hid_t dcpl;
- H5D_fill_value_t fvstatus;
- int maxdims;
- hsize_t *chsize;
- int ndims;
- int i;
- H5D_alloc_time_t at;
- H5D_fill_time_t ft;
- hsize_t tempi;
- char *tmp;
- char *t_name;
- char *t_tmp;
- char *t_prefix;
- unsigned attr_crt_order_flags;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
-
- char *rstr = (char*) HDmalloc((size_t)100);
- char *pstr = (char*) HDmalloc((size_t)100);
-
- tmp = (char*) HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ hid_t type;
+ hid_t space;
+ hid_t dcpl;
+ H5D_fill_value_t fvstatus;
+ int maxdims;
+ hsize_t * chsize;
+ int ndims;
+ int i;
+ H5D_alloc_time_t at;
+ H5D_fill_time_t ft;
+ hsize_t tempi;
+ char * tmp;
+ char * t_name;
+ char * t_tmp;
+ char * t_prefix;
+ unsigned attr_crt_order_flags;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
+
+ char *rstr = (char *)HDmalloc((size_t)100);
+ char *pstr = (char *)HDmalloc((size_t)100);
+
+ tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
HDstrcat(tmp, "/");
HDstrcat(tmp, name);
@@ -3583,28 +3753,28 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
- t_name = xml_escape_the_name(name);
- t_tmp = xml_escape_the_name(tmp);
+ t_name = xml_escape_the_name(name);
+ t_tmp = xml_escape_the_name(tmp);
t_prefix = xml_escape_the_name(prefix);
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
xml_name_to_XID(tmp, rstr, 100, 1);
xml_name_to_XID(prefix, pstr, 100, 1);
@@ -3613,10 +3783,11 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">",
- xmlnsprefix, t_name, rstr, t_tmp, pstr,
- strcmp(prefix, "") ? t_prefix : "/");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(
+ &buffer, "<%sDataset Name=\"%s\" OBJ-XID=\"%s\" H5Path= \"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">",
+ xmlnsprefix, t_name, rstr, t_tmp, pstr, strcmp(prefix, "") ? t_prefix : "/");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_name);
HDfree(t_tmp);
@@ -3625,8 +3796,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
HDfree(pstr);
HDfree(tmp);
- dcpl = H5Dget_create_plist(did);
- type = H5Dget_type(did);
+ dcpl = H5Dget_create_plist(did);
+ type = H5Dget_type(did);
space = H5Dget_space(did);
/* query the creation properties for attributes */
@@ -3634,7 +3805,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Print information about storage layout */
if (H5D_CHUNKED == H5Pget_layout(dcpl)) {
- if((maxdims = H5Sget_simple_extent_ndims(space)) < 0) {
+ if ((maxdims = H5Sget_simple_extent_ndims(space)) < 0) {
error_msg("unable to get maxdims\n");
h5tools_setstatus(EXIT_FAILURE);
}
@@ -3648,7 +3819,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
@@ -3659,7 +3831,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
h5tools_str_append(&buffer, "<%sChunkedLayout ", xmlnsprefix);
ndims = H5Pget_chunk(dcpl, maxdims, chsize);
h5tools_str_append(&buffer, "Ndims=\"%d\">", ndims);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
@@ -3670,8 +3843,10 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />", xmlnsprefix, chsize[i]);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />",
+ xmlnsprefix, chsize[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.need_prefix = TRUE;
@@ -3679,7 +3854,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sRequiredFilter>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
@@ -3692,7 +3868,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sRequiredFilter>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -3702,7 +3879,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sChunkedLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -3711,7 +3889,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
HDfree(chsize);
@@ -3725,7 +3904,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
@@ -3733,7 +3913,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sContiguousLayout/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
@@ -3741,7 +3922,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else if (H5D_COMPACT == H5Pget_layout(dcpl)) {
@@ -3752,7 +3934,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
@@ -3760,7 +3943,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sCompactLayout/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
@@ -3768,7 +3952,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sStorageLayout>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
/* and check for external.... ?? */
@@ -3821,7 +4006,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
} /* end switch */
h5tools_str_append(&buffer, "\"");
h5tools_str_append(&buffer, ">");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
dump_indent += COL;
@@ -3831,10 +4017,12 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sFillValue>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
H5Pfill_value_defined(dcpl, &fvstatus);
- if (fvstatus == H5D_FILL_VALUE_UNDEFINED || (fvstatus == H5D_FILL_VALUE_DEFAULT && ft == H5D_FILL_TIME_IFSET)) {
+ if (fvstatus == H5D_FILL_VALUE_UNDEFINED ||
+ (fvstatus == H5D_FILL_VALUE_DEFAULT && ft == H5D_FILL_TIME_IFSET)) {
ctx.indent_level++;
ctx.need_prefix = TRUE;
@@ -3842,7 +4030,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoFill/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
else {
@@ -3854,7 +4043,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sFillValue>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -3864,7 +4054,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sFillValueInfo>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
dump_indent -= COL;
@@ -3876,17 +4067,19 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
dump_indent += COL;
if ((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
- if (H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if (H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) <
+ 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
else {
- if (H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
+ if (H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function,
+ NULL) < 0) {
error_msg("error getting attribute information\n");
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- } /* end else */
+ } /* end else */
ctx.indent_level--;
dump_indent -= COL;
@@ -3894,166 +4087,182 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
if (dump_opts.display_data && (tempi > 0)) {
switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_ENUM:
- case H5T_ARRAY:
- ctx.indent_level++;
- dump_indent += COL;
- dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
- ctx.indent_level--;
- dump_indent -= COL;
- break;
-
- case H5T_TIME:
- ctx.indent_level++;
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ ctx.indent_level++;
+ dump_indent += COL;
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
- ctx.need_prefix = TRUE;
+ case H5T_TIME:
+ ctx.indent_level++;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.need_prefix = TRUE;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
- ctx.indent_level--;
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- case H5T_COMPOUND:
- ctx.need_prefix = TRUE;
+ ctx.indent_level--;
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ case H5T_COMPOUND:
+ ctx.need_prefix = TRUE;
- ctx.indent_level++;
- dump_indent += COL;
- dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
- ctx.indent_level--;
- dump_indent -= COL;
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- case H5T_REFERENCE:
- ctx.need_prefix = TRUE;
+ ctx.indent_level++;
+ dump_indent += COL;
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ case H5T_REFERENCE:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ xml_print_refs(did, DATASET_DATA);
+
+ ctx.need_prefix = TRUE;
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
+
+ case H5T_VLEN:
+ ctx.indent_level--;
+ dump_indent -= COL;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
- xml_print_refs(did, DATASET_DATA);
+ h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ dump_indent += COL;
+ ctx.indent_level++;
+ dump_indent += COL;
+ dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
+ ctx.indent_level--;
+ dump_indent -= COL;
+ break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
-
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
-
- case H5T_VLEN:
- ctx.indent_level--;
- dump_indent -= COL;
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
- dump_indent += COL;
-
- ctx.indent_level++;
- dump_indent += COL;
- dump_function_table->dump_data_function(did, DATASET_DATA, NULL, 0);
- ctx.indent_level--;
- dump_indent -= COL;
- break;
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- default:
- ctx.need_prefix = TRUE;
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
+ ctx.need_prefix = TRUE;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
}
}
else {
@@ -4065,7 +4274,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
@@ -4073,7 +4283,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
@@ -4081,7 +4292,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
}
@@ -4094,7 +4306,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataset>", xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
@@ -4113,62 +4326,64 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
static void
xml_print_enum(hid_t type)
{
- char **name = NULL; /*member names */
- unsigned char *value = NULL; /*value array */
- unsigned nmembs; /*number of members */
- hid_t super; /*enum base integer type */
- hid_t native = H5I_INVALID_HID; /*native integer datatype */
- size_t dst_size; /*destination value type size */
- unsigned i; /*miscellaneous counters */
- size_t j;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ char ** name = NULL; /*member names */
+ unsigned char * value = NULL; /*value array */
+ unsigned nmembs; /*number of members */
+ hid_t super; /*enum base integer type */
+ hid_t native = H5I_INVALID_HID; /*native integer datatype */
+ size_t dst_size; /*destination value type size */
+ unsigned i; /*miscellaneous counters */
+ size_t j;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
- ctx.cur_column = dump_indent;
+ ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
if (fp_format) {
string_dataformat.fmt_double = fp_format;
- string_dataformat.fmt_float = fp_format;
+ string_dataformat.fmt_float = fp_format;
}
if (h5tools_nCols == 0) {
- string_dataformat.line_ncols = 65535;
+ string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = dump_opts.display_escape;
- outputformat = &string_dataformat;
+ outputformat = &string_dataformat;
nmembs = (unsigned)H5Tget_nmembers(type);
- super = H5Tget_super(type);
+ super = H5Tget_super(type);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- xml_print_datatype(super,0);
+ xml_print_datatype(super, 0);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sDataType>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/*
* Determine what datatype to use for the native values. To simplify
@@ -4192,7 +4407,7 @@ xml_print_enum(hid_t type)
}
/* Get the names and raw values of all members */
- name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
+ name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size));
for (i = 0; i < nmembs; i++) {
@@ -4217,8 +4432,9 @@ xml_print_enum(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sEnumElement>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sEnumElement>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -4226,7 +4442,8 @@ xml_print_enum(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s", t_name);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_name);
ctx.indent_level--;
@@ -4234,15 +4451,17 @@ xml_print_enum(hid_t type)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sEnumElement>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sEnumElement>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sEnumValue>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<%sEnumValue>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level++;
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -4256,22 +4475,24 @@ xml_print_enum(hid_t type)
h5tools_str_append(&buffer, "%02x", value[i * dst_size + j]);
}
else if (H5T_SGN_NONE == H5Tget_sign(native)) {
- h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *)
- ((void *) (value + i * dst_size))));
+ h5tools_str_append(&buffer, "%" H5_PRINTF_LL_WIDTH "u",
+ *((unsigned long long *)((void *)(value + i * dst_size))));
}
else {
- h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "d",
- *((long long *) ((void *) (value + i * dst_size))));
+ h5tools_str_append(&buffer, "%" H5_PRINTF_LL_WIDTH "d",
+ *((long long *)((void *)(value + i * dst_size))));
}
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
ctx.need_prefix = TRUE;
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sEnumValue>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "</%sEnumValue>", xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
+ (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
dump_indent -= COL;
@@ -4286,4 +4507,3 @@ xml_print_enum(hid_t type)
HDfree(value);
H5Tclose(super);
}
-
diff --git a/tools/src/h5dump/h5dump_xml.h b/tools/src/h5dump/h5dump_xml.h
index 3c59917..4798ea8 100644
--- a/tools/src/h5dump/h5dump_xml.h
+++ b/tools/src/h5dump/h5dump_xml.h
@@ -13,7 +13,7 @@
#ifndef H5DUMP_XML_H__
#define H5DUMP_XML_H__
-extern const char *xmlnsprefix;
+extern const char *xmlnsprefix;
#ifdef __cplusplus
extern "C" {
@@ -22,16 +22,16 @@ extern "C" {
/* The dump functions of the dump_function_table */
/* XML format: same interface, alternative output */
-void xml_dump_group(hid_t, const char *);
-void xml_dump_named_datatype(hid_t, const char *);
-void xml_dump_dataset(hid_t, const char *, struct subset_t *);
-void xml_dump_dataspace(hid_t space);
-void xml_dump_datatype(hid_t type);
-herr_t xml_dump_attr(hid_t, const char *, const H5A_info_t *, void *);
-void xml_dump_data(hid_t, int, struct subset_t *, int);
+void xml_dump_group(hid_t, const char *);
+void xml_dump_named_datatype(hid_t, const char *);
+void xml_dump_dataset(hid_t, const char *, struct subset_t *);
+void xml_dump_dataspace(hid_t space);
+void xml_dump_datatype(hid_t type);
+herr_t xml_dump_attr(hid_t, const char *, const H5A_info_t *, void *);
+void xml_dump_data(hid_t, int, struct subset_t *, int);
#ifdef __cplusplus
}
#endif
-#endif /* !H5DUMP_XML_H__ */
+#endif /* !H5DUMP_XML_H__ */
diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c
index bd02e3b..43cc0e1 100644
--- a/tools/src/h5format_convert/h5format_convert.c
+++ b/tools/src/h5format_convert/h5format_convert.c
@@ -15,7 +15,6 @@
* Programmer: Vailin Choi; Feb 2015
*/
-
/*
* We include the private header file so we can get to the uniform
* programming environment it declares.
@@ -29,42 +28,39 @@
/* Name of tool */
#define PROGRAMNAME "h5format_convert"
-static char *fname_g = NULL;
-static char *dname_g = NULL;
-static int dset_g = FALSE;
-static int noop_g = FALSE;
-static int verbose_g = 0;
+static char *fname_g = NULL;
+static char *dname_g = NULL;
+static int dset_g = FALSE;
+static int noop_g = FALSE;
+static int verbose_g = 0;
/*
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVvd:n";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "hel", no_arg, 'h'},
- { "he", no_arg, 'h'},
- { "version", no_arg, 'V' },
- { "version", no_arg, 'V' },
- { "versio", no_arg, 'V' },
- { "versi", no_arg, 'V' },
- { "vers", no_arg, 'V' },
- { "verbose", no_arg, 'v' },
- { "verbos", no_arg, 'v' },
- { "verbo", no_arg, 'v' },
- { "verb", no_arg, 'v' },
- { "dname", require_arg, 'd' },
- { "dnam", require_arg, 'd' },
- { "dna", require_arg, 'd' },
- { "dn", require_arg, 'd' },
- { "noop", no_arg, 'n' },
- { "noo", no_arg, 'n' },
- { "no", no_arg, 'n' },
- { "enable-error-stack", no_arg, 'E' },
- { NULL, 0, '\0' }
-};
-
-
+static const char * s_opts = "hVvd:n";
+static struct long_options l_opts[] = {{"help", no_arg, 'h'},
+ {"hel", no_arg, 'h'},
+ {"he", no_arg, 'h'},
+ {"version", no_arg, 'V'},
+ {"version", no_arg, 'V'},
+ {"versio", no_arg, 'V'},
+ {"versi", no_arg, 'V'},
+ {"vers", no_arg, 'V'},
+ {"verbose", no_arg, 'v'},
+ {"verbos", no_arg, 'v'},
+ {"verbo", no_arg, 'v'},
+ {"verb", no_arg, 'v'},
+ {"dname", require_arg, 'd'},
+ {"dnam", require_arg, 'd'},
+ {"dna", require_arg, 'd'},
+ {"dn", require_arg, 'd'},
+ {"noop", no_arg, 'n'},
+ {"noo", no_arg, 'n'},
+ {"no", no_arg, 'n'},
+ {"enable-error-stack", no_arg, 'E'},
+ {NULL, 0, '\0'}};
+
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -74,7 +70,8 @@ static struct long_options l_opts[] = {
*
*-------------------------------------------------------------------------
*/
-static void usage(const char *prog)
+static void
+usage(const char *prog)
{
HDfprintf(stdout, "usage: %s [OPTIONS] file_name\n", prog);
HDfprintf(stdout, " OPTIONS\n");
@@ -118,7 +115,7 @@ parse_command_line(int argc, const char **argv)
{
int opt;
- /* no arguments */
+ /* no arguments */
if (argc == 1) {
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
@@ -127,7 +124,7 @@ parse_command_line(int argc, const char **argv)
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch((char) opt) {
+ switch ((char)opt) {
case 'h':
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_SUCCESS);
@@ -143,9 +140,9 @@ parse_command_line(int argc, const char **argv)
break;
case 'd': /* -d dname */
- if(opt_arg != NULL && *opt_arg)
+ if (opt_arg != NULL && *opt_arg)
dname_g = HDstrdup(opt_arg);
- if(dname_g == NULL) {
+ if (dname_g == NULL) {
h5tools_setstatus(EXIT_FAILURE);
error_msg("No dataset name\n", opt_arg);
usage(h5tools_getprogname());
@@ -168,7 +165,7 @@ parse_command_line(int argc, const char **argv)
goto error;
break;
} /* switch */
- } /* while */
+ } /* while */
if (argc <= opt_ind) {
error_msg("missing file name\n");
@@ -179,13 +176,13 @@ parse_command_line(int argc, const char **argv)
fname_g = HDstrdup(argv[opt_ind]);
- return(0);
+ return (0);
error:
- return(-1); ;
+ return (-1);
+ ;
} /* parse_command_line() */
-
/*-------------------------------------------------------------------------
* Function: leave
*
@@ -224,134 +221,138 @@ leave(int ret)
static int
convert(hid_t fid, const char *dname)
{
- hid_t dcpl = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- H5D_layout_t layout_type;
+ hid_t dcpl = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ H5D_layout_t layout_type;
H5D_chunk_index_t idx_type;
/* Open the dataset */
- if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) {
+ if ((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) {
error_msg("unable to open dataset \"%s\"\n", dname);
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
- else if(verbose_g)
+ else if (verbose_g)
HDfprintf(stdout, "Open the dataset\n");
/* Get the dataset's creation property list */
- if((dcpl = H5Dget_create_plist(did)) < 0) {
+ if ((dcpl = H5Dget_create_plist(did)) < 0) {
error_msg("unable to get the dataset creation property list\n");
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
/* Get the dataset's layout */
- if((layout_type = H5Pget_layout(dcpl)) < 0) {
+ if ((layout_type = H5Pget_layout(dcpl)) < 0) {
error_msg("unable to get the dataset layout type\n");
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
- else if(verbose_g)
+ else if (verbose_g)
HDfprintf(stdout, "Retrieve the dataset's layout\n");
- switch(layout_type) {
- case H5D_CHUNKED:
- if(verbose_g)
- HDfprintf(stdout, "Dataset is a chunked dataset\n");
-
- /* Get the dataset's chunk indexing type */
- if(H5Dget_chunk_index_type(did, &idx_type) < 0) {
- error_msg("unable to get the chunk indexing type for \"%s\"\n", dname);
- h5tools_setstatus(EXIT_FAILURE);
- goto error;
- }
- else if(verbose_g)
- HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n");
+ switch (layout_type) {
+ case H5D_CHUNKED:
+ if (verbose_g)
+ HDfprintf(stdout, "Dataset is a chunked dataset\n");
- if(idx_type == H5D_CHUNK_IDX_BTREE) {
- if(verbose_g)
- HDfprintf(stdout, "Dataset's chunk indexing type is already version 1 B-tree: no further action\n");
- h5tools_setstatus(EXIT_SUCCESS);
+ /* Get the dataset's chunk indexing type */
+ if (H5Dget_chunk_index_type(did, &idx_type) < 0) {
+ error_msg("unable to get the chunk indexing type for \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
+ }
+ else if (verbose_g)
+ HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n");
+
+ if (idx_type == H5D_CHUNK_IDX_BTREE) {
+ if (verbose_g)
+ HDfprintf(
+ stdout,
+ "Dataset's chunk indexing type is already version 1 B-tree: no further action\n");
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto done;
+ }
+ else if (verbose_g)
+ HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n");
+
+ break;
+
+ case H5D_CONTIGUOUS:
+ if (verbose_g)
+ HDfprintf(stdout, "Dataset is a contiguous dataset: downgrade layout version as needed\n");
+ break;
+
+ case H5D_COMPACT:
+ if (verbose_g)
+ HDfprintf(stdout, "Dataset is a compact dataset: downgrade layout version as needed\n");
+ break;
+
+ case H5D_VIRTUAL:
+ if (verbose_g)
+ HDfprintf(stdout, "No further action for virtual dataset\n");
goto done;
- }
- else if (verbose_g)
- HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n");
-
- break;
- case H5D_CONTIGUOUS:
- if(verbose_g)
- HDfprintf(stdout, "Dataset is a contiguous dataset: downgrade layout version as needed\n");
- break;
-
- case H5D_COMPACT:
- if(verbose_g)
- HDfprintf(stdout, "Dataset is a compact dataset: downgrade layout version as needed\n");
- break;
-
- case H5D_VIRTUAL:
- if(verbose_g)
- HDfprintf(stdout, "No further action for virtual dataset\n");
- goto done;
-
- case H5D_NLAYOUTS:
- case H5D_LAYOUT_ERROR:
- default:
- error_msg("unknown layout type for \"%s\"\n", dname);
- h5tools_setstatus(EXIT_FAILURE);
- goto error;
+ case H5D_NLAYOUTS:
+ case H5D_LAYOUT_ERROR:
+ default:
+ error_msg("unknown layout type for \"%s\"\n", dname);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto error;
} /* end switch */
/* No further action if it is a noop */
- if(noop_g) {
- if(verbose_g)
+ if (noop_g) {
+ if (verbose_g)
HDfprintf(stdout, "Not converting the dataset\n");
h5tools_setstatus(EXIT_SUCCESS);
goto done;
}
- if(verbose_g)
+ if (verbose_g)
HDfprintf(stdout, "Converting the dataset...\n");
/* Downgrade the dataset */
- if(H5Dformat_convert(did) < 0) {
+ if (H5Dformat_convert(did) < 0) {
error_msg("unable to downgrade dataset \"%s\"\n", dname);
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
- else if(verbose_g)
+ else if (verbose_g)
HDfprintf(stdout, "Done\n");
done:
/* Close the dataset */
- if(H5Dclose(did) < 0) {
+ if (H5Dclose(did) < 0) {
error_msg("unable to close dataset \"%s\"\n", dname);
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
- else if(verbose_g)
+ else if (verbose_g)
HDfprintf(stdout, "Close the dataset\n");
/* Close the dataset creation property list */
- if(H5Pclose(dcpl) < 0) {
+ if (H5Pclose(dcpl) < 0) {
error_msg("unable to close dataset creation property list\n");
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
- else if(verbose_g)
+ else if (verbose_g)
HDprintf("Close the dataset creation property list\n");
return 0;
error:
- if(verbose_g)
+ if (verbose_g)
HDfprintf(stdout, "Error encountered\n");
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Dclose(did);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* convert() */
@@ -372,14 +373,14 @@ convert_dsets_cb(const char *path, const H5O_info_t *oi, const char *already_vis
hid_t fid = *(hid_t *)_fid;
/* If the object has already been seen then just return */
- if(NULL == already_visited) {
- if(oi->type == H5O_TYPE_DATASET) {
- if(verbose_g)
+ if (NULL == already_visited) {
+ if (oi->type == H5O_TYPE_DATASET) {
+ if (verbose_g)
HDfprintf(stdout, "Going to process dataset:%s...\n", path);
- if(convert(fid, path) < 0)
+ if (convert(fid, path) < 0)
goto error;
} /* end if */
- } /* end if */
+ } /* end if */
return 0;
@@ -387,7 +388,6 @@ error:
return -1;
} /* end convert_dsets_cb() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -411,41 +411,41 @@ main(int argc, const char *argv[])
h5tools_init();
/* Parse command line options */
- if(parse_command_line(argc, argv) < 0)
+ if (parse_command_line(argc, argv) < 0)
goto done;
- else if(verbose_g)
+ else if (verbose_g)
HDfprintf(stdout, "Process command line options\n");
- if(noop_g && verbose_g)
+ if (noop_g && verbose_g)
HDfprintf(stdout, "It is noop...\n");
/* enable error reporting if command line option */
h5tools_error_report();
/* Open the HDF5 file */
- if((fid = h5tools_fopen(fname_g, H5F_ACC_RDWR, H5P_DEFAULT, FALSE, NULL, 0)) < 0) {
+ if ((fid = h5tools_fopen(fname_g, H5F_ACC_RDWR, H5P_DEFAULT, FALSE, NULL, 0)) < 0) {
error_msg("unable to open file \"%s\"\n", fname_g);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- else if(verbose_g)
+ else if (verbose_g)
HDfprintf(stdout, "Open the file %s\n", fname_g);
- if(dset_g) { /* Convert a specified dataset in the file */
- if(verbose_g)
+ if (dset_g) { /* Convert a specified dataset in the file */
+ if (verbose_g)
HDfprintf(stdout, "Going to process dataset: %s...\n", dname_g);
- if(convert(fid, dname_g) < 0)
+ if (convert(fid, dname_g) < 0)
goto done;
}
else { /* Convert all datasets in the file */
- if(verbose_g)
+ if (verbose_g)
HDfprintf(stdout, "Processing all datasets in the file...\n");
- if(h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid, H5O_INFO_BASIC) < 0)
+ if (h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid, H5O_INFO_BASIC) < 0)
goto done;
} /* end else */
- if(verbose_g) {
- if(noop_g) {
+ if (verbose_g) {
+ if (noop_g) {
HDfprintf(stdout, "Not processing the file's superblock...\n");
h5tools_setstatus(EXIT_SUCCESS);
goto done;
@@ -454,7 +454,7 @@ main(int argc, const char *argv[])
} /* end if */
/* Process superblock */
- if(H5Fformat_convert(fid) < 0) {
+ if (H5Fformat_convert(fid) < 0) {
error_msg("unable to convert file's superblock\"%s\"\n", fname_g);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -462,22 +462,21 @@ main(int argc, const char *argv[])
done:
/* Close the file */
- if(fid >= 0) {
- if(H5Fclose(fid) < 0) {
+ if (fid >= 0) {
+ if (H5Fclose(fid) < 0) {
error_msg("unable to close file \"%s\"\n", fname_g);
h5tools_setstatus(EXIT_FAILURE);
}
- else if(verbose_g) {
+ else if (verbose_g) {
HDfprintf(stdout, "Close the file\n");
}
- } /* end if */
+ } /* end if */
- if(fname_g)
+ if (fname_g)
HDfree(fname_g);
- if(dname_g)
+ if (dname_g)
HDfree(dname_g);
leave(h5tools_getstatus());
} /* end main() */
-
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c
index 4221eec..7a7887f 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -27,68 +27,69 @@
#endif
/* Local function declarations */
-static int gtoken(char *s);
-static int process(struct Options *opt);
-static int processConfigurationFile(char *infile, struct Input *in);
-static int mapKeywordToIndex(char *key);
-static int parsePathInfo(struct path_info *path, char *strm);
-static int parseDimensions(struct Input *in, char *strm);
-static int getInputSize(struct Input *in, int ival);
-static int getInputClass(struct Input *in, char * strm);
-static int getInputClassType(struct Input *in, char * strm);
-static int getInputByteOrder(struct Input *in, FILE *strm);
-static int InputClassStrToInt(char *temp);
-static int getRank(struct Input *in, FILE *strm);
-static int getDimensionSizes(struct Input *in, FILE *strm);
-static int getOutputSize(struct Input *in, FILE *strm);
-static int getOutputClass(struct Input *in, FILE *strm);
-static int OutputClassStrToInt(char *temp);
-static int getOutputArchitecture(struct Input *in, FILE *strm);
-static int OutputArchStrToInt(const char *temp);
-static int getOutputByteOrder(struct Input *in, FILE *strm);
-static int OutputByteOrderStrToInt(const char *temp);
-static int getChunkedDimensionSizes(struct Input *in, FILE *strm);
-static int getCompressionType(struct Input *in, FILE *strm);
-static int CompressionTypeStrToInt(char *temp);
-static int getCompressionParameter(struct Input *in, FILE *strm);
-static int getExternalFilename(struct Input *in, FILE *strm);
-static int getMaximumDimensionSizes(struct Input *in, FILE *strm);
-static int processDataFile(char *infile, struct Input *in, hid_t file_id);
-static int readIntegerData(FILE *strm, struct Input *in);
-static int readFloatData(FILE *strm, struct Input *in);
-static int allocateIntegerStorage(struct Input *in);
-static int allocateFloatStorage(struct Input *in);
-static int readUIntegerData(FILE *strm, struct Input *in);
-static int allocateUIntegerStorage(struct Input *in);
-static int validateConfigurationParameters(struct Input *in);
-static int processStrData(FILE *strm, struct Input *in, hid_t file_id);
-static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id);
-uint16_t swap_uint16(uint16_t val);
-int16_t swap_int16(int16_t val);
-uint32_t swap_uint32(uint32_t val);
-int32_t swap_int32(int32_t val);
-int64_t swap_int64(int64_t val);
-uint64_t swap_uint64(uint64_t val);
-
-int main(int argc, char *argv[])
+static int gtoken(char *s);
+static int process(struct Options *opt);
+static int processConfigurationFile(char *infile, struct Input *in);
+static int mapKeywordToIndex(char *key);
+static int parsePathInfo(struct path_info *path, char *strm);
+static int parseDimensions(struct Input *in, char *strm);
+static int getInputSize(struct Input *in, int ival);
+static int getInputClass(struct Input *in, char *strm);
+static int getInputClassType(struct Input *in, char *strm);
+static int getInputByteOrder(struct Input *in, FILE *strm);
+static int InputClassStrToInt(char *temp);
+static int getRank(struct Input *in, FILE *strm);
+static int getDimensionSizes(struct Input *in, FILE *strm);
+static int getOutputSize(struct Input *in, FILE *strm);
+static int getOutputClass(struct Input *in, FILE *strm);
+static int OutputClassStrToInt(char *temp);
+static int getOutputArchitecture(struct Input *in, FILE *strm);
+static int OutputArchStrToInt(const char *temp);
+static int getOutputByteOrder(struct Input *in, FILE *strm);
+static int OutputByteOrderStrToInt(const char *temp);
+static int getChunkedDimensionSizes(struct Input *in, FILE *strm);
+static int getCompressionType(struct Input *in, FILE *strm);
+static int CompressionTypeStrToInt(char *temp);
+static int getCompressionParameter(struct Input *in, FILE *strm);
+static int getExternalFilename(struct Input *in, FILE *strm);
+static int getMaximumDimensionSizes(struct Input *in, FILE *strm);
+static int processDataFile(char *infile, struct Input *in, hid_t file_id);
+static int readIntegerData(FILE *strm, struct Input *in);
+static int readFloatData(FILE *strm, struct Input *in);
+static int allocateIntegerStorage(struct Input *in);
+static int allocateFloatStorage(struct Input *in);
+static int readUIntegerData(FILE *strm, struct Input *in);
+static int allocateUIntegerStorage(struct Input *in);
+static int validateConfigurationParameters(struct Input *in);
+static int processStrData(FILE *strm, struct Input *in, hid_t file_id);
+static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id);
+uint16_t swap_uint16(uint16_t val);
+int16_t swap_int16(int16_t val);
+uint32_t swap_uint32(uint32_t val);
+int32_t swap_int32(int32_t val);
+int64_t swap_int64(int64_t val);
+uint64_t swap_uint64(uint64_t val);
+
+int
+main(int argc, char *argv[])
{
struct Options *opt;
int outfile_named = FALSE;
int token;
int i;
int state = 0;
- struct Input *in = NULL;
-
- const char *err1 = "Invalid number of arguments: %d.\n";
- const char *err2 = "Error in state table.\n";
- const char *err3 = "No output file given.\n";
- const char *err4 = "Program aborted.\n";
- const char *err5 = "Invalid path %s.\n";
- const char *err6 = "Invalid dimensions - %s.\n";
- const char *err7 = "Invalid type of data - %s.\n";
- const char *err8 = "Invalid size of data - %s.\n";
- const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n";
- const char *err10 = "Length of output file name limited to 255 chars.\n";
+ struct Input * in = NULL;
+
+ const char *err1 = "Invalid number of arguments: %d.\n";
+ const char *err2 = "Error in state table.\n";
+ const char *err3 = "No output file given.\n";
+ const char *err4 = "Program aborted.\n";
+ const char *err5 = "Invalid path %s.\n";
+ const char *err6 = "Invalid dimensions - %s.\n";
+ const char *err7 = "Invalid type of data - %s.\n";
+ const char *err8 = "Invalid size of data - %s.\n";
+ const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n";
+ const char *err10 = "Length of output file name limited to 255 chars.\n";
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -96,10 +97,10 @@ int main(int argc, char *argv[])
/* Initialize h5tools lib */
h5tools_init();
- (void) HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0);
- (void) HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0);
+ (void)HDsetvbuf(stderr, (char *)NULL, _IOLBF, 0);
+ (void)HDsetvbuf(stdout, (char *)NULL, _IOLBF, 0);
- if((opt = (struct Options *)HDcalloc(1, sizeof(struct Options))) == NULL)
+ if ((opt = (struct Options *)HDcalloc(1, sizeof(struct Options))) == NULL)
goto err;
if (argv[1] && (HDstrcmp("-V", argv[1]) == 0)) {
@@ -111,7 +112,7 @@ int main(int argc, char *argv[])
* validate the number of command line arguments
*/
if (argc < 2) {
- (void) HDfprintf(stderr, err1, argc);
+ (void)HDfprintf(stderr, err1, argc);
usage(argv[0]);
goto err;
}
@@ -129,105 +130,105 @@ int main(int argc, char *argv[])
switch (state) {
- case 1: /* counting input files */
- if (opt->fcount < 29) {
- (void) HDstrcpy(opt->infiles[opt->fcount].datafile, argv[i]);
- in = &(opt->infiles[opt->fcount].in);
- opt->infiles[opt->fcount].config = 0;
- setDefaultValues(in, opt->fcount);
- opt->fcount++;
- }
- else {
- (void) HDfprintf(stderr, err9, argv[i]);
- goto err;
- }
+ case 1: /* counting input files */
+ if (opt->fcount < 29) {
+ (void)HDstrcpy(opt->infiles[opt->fcount].datafile, argv[i]);
+ in = &(opt->infiles[opt->fcount].in);
+ opt->infiles[opt->fcount].config = 0;
+ setDefaultValues(in, opt->fcount);
+ opt->fcount++;
+ }
+ else {
+ (void)HDfprintf(stderr, err9, argv[i]);
+ goto err;
+ }
- break;
+ break;
- case 2: /* -c found; look for configfile */
- break;
+ case 2: /* -c found; look for configfile */
+ break;
- case 3: /* get configfile name */
- (void) HDstrcpy(opt->infiles[opt->fcount-1].configfile, argv[i]);
- opt->infiles[opt->fcount - 1].config = 1;
- break;
+ case 3: /* get configfile name */
+ (void)HDstrcpy(opt->infiles[opt->fcount - 1].configfile, argv[i]);
+ opt->infiles[opt->fcount - 1].config = 1;
+ break;
- case 4: /* -o found; look for outfile */
- break;
+ case 4: /* -o found; look for outfile */
+ break;
- case 5: /* get outfile found */
- if (HDstrlen(argv[i]) > MAX_PATH_NAME_LENGTH) {
- (void) HDfprintf(stderr, err10, argv[i]);
- goto err;
- }
- (void) HDstrcpy(opt->outfile, argv[i]);
- outfile_named = TRUE;
- break;
+ case 5: /* get outfile found */
+ if (HDstrlen(argv[i]) > MAX_PATH_NAME_LENGTH) {
+ (void)HDfprintf(stderr, err10, argv[i]);
+ goto err;
+ }
+ (void)HDstrcpy(opt->outfile, argv[i]);
+ outfile_named = TRUE;
+ break;
- case 6: /* -h found; help, then exit */
- help(argv[0]);
- HDexit(EXIT_SUCCESS);
- break;
+ case 6: /* -h found; help, then exit */
+ help(argv[0]);
+ HDexit(EXIT_SUCCESS);
+ break;
- case 7: /* -d found; look for dimensions */
- break;
+ case 7: /* -d found; look for dimensions */
+ break;
- case 8: /* read dimensions */
- if (parseDimensions(in, argv[i]) == -1) {
- (void) HDfprintf(stderr, err6, argv[i]);
- goto err;
- }
- break;
+ case 8: /* read dimensions */
+ if (parseDimensions(in, argv[i]) == -1) {
+ (void)HDfprintf(stderr, err6, argv[i]);
+ goto err;
+ }
+ break;
- case 9: /* -p found; look for path name */
- break;
+ case 9: /* -p found; look for path name */
+ break;
- case 10: /* read path name */
- if (parsePathInfo(&in->path, argv[i]) == -1) {
- (void) HDfprintf(stderr, err5, argv[i]);
- goto err;
- }
- break;
+ case 10: /* read path name */
+ if (parsePathInfo(&in->path, argv[i]) == -1) {
+ (void)HDfprintf(stderr, err5, argv[i]);
+ goto err;
+ }
+ break;
- case 11: /* -t found; look for data type */
- break;
+ case 11: /* -t found; look for data type */
+ break;
- case 12: /* read data type */
- if (getInputClass(in, argv[i]) == -1) {
- (void) HDfprintf(stderr, err7, argv[i]);
- goto err;
- }
+ case 12: /* read data type */
+ if (getInputClass(in, argv[i]) == -1) {
+ (void)HDfprintf(stderr, err7, argv[i]);
+ goto err;
+ }
- if (in->inputClass == 0 || in->inputClass == 4)
- in->outputClass = 0;
- if (in->inputClass == 1 || in->inputClass == 2 || in->inputClass == 3)
- in->outputClass = 1;
- if (in->inputClass == 6 || in->inputClass == 7)
- in->outputClass = 2;
- break;
+ if (in->inputClass == 0 || in->inputClass == 4)
+ in->outputClass = 0;
+ if (in->inputClass == 1 || in->inputClass == 2 || in->inputClass == 3)
+ in->outputClass = 1;
+ if (in->inputClass == 6 || in->inputClass == 7)
+ in->outputClass = 2;
+ break;
- case 13: /* -s found; look for data size */
- break;
+ case 13: /* -s found; look for data size */
+ break;
- case 14: /* read data size */
- if (getInputSize(in, (int) HDstrtol(argv[i], NULL, BASE_10)) == -1) {
- (void) HDfprintf(stderr, err8, argv[i]);
- goto err;
- }
- /*set default value for output-size */
- in->outputSize = in->inputSize;
- break;
+ case 14: /* read data size */
+ if (getInputSize(in, (int)HDstrtol(argv[i], NULL, BASE_10)) == -1) {
+ (void)HDfprintf(stderr, err8, argv[i]);
+ goto err;
+ }
+ /*set default value for output-size */
+ in->outputSize = in->inputSize;
+ break;
- case ERR: /* command syntax error */
- default:
- (void) HDfprintf(stderr, "%s", err2);
- usage(argv[0]);
- goto err;
+ case ERR: /* command syntax error */
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ usage(argv[0]);
+ goto err;
}
}
if (FALSE == outfile_named) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
usage(argv[0]);
goto err;
}
@@ -252,7 +253,7 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS;
err:
- (void) HDfprintf(stderr, "%s", err4);
+ (void)HDfprintf(stderr, "%s", err4);
for (i = 0; i < opt->fcount; i++) {
in = &(opt->infiles[i].in);
if (in->sizeOfDimension)
@@ -271,10 +272,11 @@ err:
return EXIT_FAILURE;
}
-static int gtoken(char *s)
+static int
+gtoken(char *s)
{
- size_t len;
- int token = ERR;
+ size_t len;
+ int token = ERR;
const char *err1 = "Illegal argument: %s.\n";
@@ -284,47 +286,47 @@ static int gtoken(char *s)
if (s[0] == '-') { /* option name (or negative number) */
len = HDstrlen(&s[1]);
switch (s[1]) {
- case 'o':
- if (!HDstrncmp("outfile", &s[1], len))
- token = OPT_o;
- break;
+ case 'o':
+ if (!HDstrncmp("outfile", &s[1], len))
+ token = OPT_o;
+ break;
- case 'c':
- if (!HDstrncmp("config", &s[1], len))
- token = OPT_c;
- break;
+ case 'c':
+ if (!HDstrncmp("config", &s[1], len))
+ token = OPT_c;
+ break;
- case 'h':
- if (!HDstrncmp("help", &s[1], len))
- token = OPT_h;
- break;
+ case 'h':
+ if (!HDstrncmp("help", &s[1], len))
+ token = OPT_h;
+ break;
- case 'd':
- if (!HDstrncmp("dims", &s[1], len))
- token = OPT_d;
- break;
+ case 'd':
+ if (!HDstrncmp("dims", &s[1], len))
+ token = OPT_d;
+ break;
- case 'p':
- if (!HDstrncmp("path", &s[1], len))
- token = OPT_p;
- break;
+ case 'p':
+ if (!HDstrncmp("path", &s[1], len))
+ token = OPT_p;
+ break;
- case 't':
- if (!HDstrncmp("type", &s[1], len))
- token = OPT_t;
- break;
+ case 't':
+ if (!HDstrncmp("type", &s[1], len))
+ token = OPT_t;
+ break;
- case 's':
- if (!HDstrncmp("size", &s[1], len))
- token = OPT_s;
- break;
- default:
- token = ERR; /* not a supported option tag */
- break;
+ case 's':
+ if (!HDstrncmp("size", &s[1], len))
+ token = OPT_s;
+ break;
+ default:
+ token = ERR; /* not a supported option tag */
+ break;
}
if (token == ERR)
- (void) HDfprintf(stderr, err1, s);
+ (void)HDfprintf(stderr, err1, s);
}
else { /* filename */
token = FILNAME;
@@ -347,19 +349,20 @@ static int gtoken(char *s)
*-------------------------------------------------------------------------
*/
-static int processDataFile(char *infile, struct Input *in, hid_t file_id)
+static int
+processDataFile(char *infile, struct Input *in, hid_t file_id)
{
- FILE *strm = NULL;
- const char *err1 = "Unable to open the input file %s for reading.\n";
- const char *err2 = "Error in allocating integer data storage.\n";
- const char *err3 = "Error in allocating floating-point data storage.\n";
- const char *err4 = "Error in reading integer data.\n";
- const char *err5 = "Error in reading floating-point data.\n";
- const char *err6 = "Error in allocating unsigned integer data storage.\n";
- const char *err7 = "Error in reading unsigned integer data.\n";
- const char *err10 = "Unrecognized input class type.\n";
- const char *err11 = "Error in reading string data.\n";
- int retval = -1;
+ FILE * strm = NULL;
+ const char *err1 = "Unable to open the input file %s for reading.\n";
+ const char *err2 = "Error in allocating integer data storage.\n";
+ const char *err3 = "Error in allocating floating-point data storage.\n";
+ const char *err4 = "Error in reading integer data.\n";
+ const char *err5 = "Error in reading floating-point data.\n";
+ const char *err6 = "Error in allocating unsigned integer data storage.\n";
+ const char *err7 = "Error in reading unsigned integer data.\n";
+ const char *err10 = "Unrecognized input class type.\n";
+ const char *err11 = "Error in reading string data.\n";
+ int retval = -1;
/*-------------------------------------------------------------------------
* special case for opening binary classes in H5_HAVE_WIN32_API
@@ -368,10 +371,10 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id)
* "UIN" denotes an unsigned integer binary file,
*-------------------------------------------------------------------------
*/
- if (in->inputClass == 4 /* "IN" */|| in->inputClass == 3 /* "FP" */|| in->inputClass == 7 /* "UIN" */) {
+ if (in->inputClass == 4 /* "IN" */ || in->inputClass == 3 /* "FP" */ || in->inputClass == 7 /* "UIN" */) {
if ((strm = HDfopen(infile, READ_OPEN_FLAGS)) == NULL) {
- (void) HDfprintf(stderr, err1, infile);
+ (void)HDfprintf(stderr, err1, infile);
goto error;
}
}
@@ -381,85 +384,85 @@ static int processDataFile(char *infile, struct Input *in, hid_t file_id)
*/
else {
if ((strm = HDfopen(infile, "r")) == NULL) {
- (void) HDfprintf(stderr, err1, infile);
+ (void)HDfprintf(stderr, err1, infile);
goto error;
}
}
switch (in->inputClass) {
- case 0: /* TEXTIN */
- case 4: /* IN */
- if (allocateIntegerStorage(in) == -1) {
- (void) HDfprintf(stderr, err2, infile);
- goto error;
- }
+ case 0: /* TEXTIN */
+ case 4: /* IN */
+ if (allocateIntegerStorage(in) == -1) {
+ (void)HDfprintf(stderr, err2, infile);
+ goto error;
+ }
- if (readIntegerData(strm, in) == -1) {
- (void) HDfprintf(stderr, err4, infile);
- goto error;
- }
- break;
+ if (readIntegerData(strm, in) == -1) {
+ (void)HDfprintf(stderr, err4, infile);
+ goto error;
+ }
+ break;
- case 1: /* TEXTFP */
- case 2: /* TEXTFPE */
- case 3: /* FP */
- if (allocateFloatStorage(in) == -1) {
- (void) HDfprintf(stderr, err3, infile);
- goto error;
+ case 1: /* TEXTFP */
+ case 2: /* TEXTFPE */
+ case 3: /* FP */
+ if (allocateFloatStorage(in) == -1) {
+ (void)HDfprintf(stderr, err3, infile);
+ goto error;
+ }
- }
+ if (readFloatData(strm, in) == -1) {
+ (void)HDfprintf(stderr, err5, infile);
+ goto error;
+ }
+ break;
- if (readFloatData(strm, in) == -1) {
- (void) HDfprintf(stderr, err5, infile);
- goto error;
- }
- break;
+ case 5: /* STR */
+ if (in->h5dumpInput) {
+ if (processStrHDFData(strm, in, file_id) == -1) {
+ (void)HDfprintf(stderr, err11, infile);
+ goto error;
+ }
+ }
+ else {
+ if (processStrData(strm, in, file_id) == -1) {
+ (void)HDfprintf(stderr, err11, infile);
+ goto error;
+ }
+ }
+
+ break;
- case 5: /* STR */
- if (in->h5dumpInput) {
- if (processStrHDFData(strm, in, file_id) == -1) {
- (void) HDfprintf(stderr, err11, infile);
+ case 6: /* TEXTUIN */
+ case 7: /* UIN */
+ if (allocateUIntegerStorage(in) == -1) {
+ (void)HDfprintf(stderr, err6, infile);
goto error;
}
- }
- else {
- if (processStrData(strm, in, file_id) == -1) {
- (void) HDfprintf(stderr, err11, infile);
+ if (readUIntegerData(strm, in) == -1) {
+ (void)HDfprintf(stderr, err7, infile);
goto error;
}
- }
-
- break;
+ break;
- case 6: /* TEXTUIN */
- case 7: /* UIN */
- if (allocateUIntegerStorage(in) == -1) {
- (void) HDfprintf(stderr, err6, infile);
- goto error;
- }
- if (readUIntegerData(strm, in) == -1) {
- (void) HDfprintf(stderr, err7, infile);
+ default:
+ (void)HDfprintf(stderr, "%s", err10);
goto error;
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err10);
- goto error;
}
/* Set success return value */
retval = 0;
error:
- if(strm)
+ if (strm)
HDfclose(strm);
- return(retval);
+ return (retval);
}
-static int readIntegerData(FILE *strm, struct Input *in)
+static int
+readIntegerData(FILE *strm, struct Input *in)
{
- H5DT_INT8 *in08;
+ H5DT_INT8 * in08;
H5DT_INT16 *in16;
H5DT_INT16 temp16;
H5DT_INT32 *in32;
@@ -469,9 +472,9 @@ static int readIntegerData(FILE *strm, struct Input *in)
H5DT_INT64 temp64;
char buffer[256];
#endif
- hsize_t len = 1;
- hsize_t i;
- int j;
+ hsize_t len = 1;
+ hsize_t i;
+ int j;
const char *err1 = "Unable to get integer value from file.\n";
const char *err2 = "Unrecognized input class type.\n";
@@ -481,160 +484,161 @@ static int readIntegerData(FILE *strm, struct Input *in)
len *= in->sizeOfDimension[j];
switch (in->inputSize) {
- case 8:
- switch (in->inputClass) {
- case 0: /* TEXTIN */
- in08 = (H5DT_INT8 *) in->data;
- for (i = 0; i < len; i++, in08++) {
- if (fscanf(strm, "%hd", &temp16) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- (*in08) = (H5DT_INT8) temp16;
- }
- break;
+ case 8:
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ in08 = (H5DT_INT8 *)in->data;
+ for (i = 0; i < len; i++, in08++) {
+ if (fscanf(strm, "%hd", &temp16) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ (*in08) = (H5DT_INT8)temp16;
+ }
+ break;
- case 4: /* IN */
- in08 = (H5DT_INT8 *) in->data;
- for (i = 0; i < len; i++, in08++) {
- if (HDfread((char *) in08, sizeof(H5DT_INT8), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
+ case 4: /* IN */
+ in08 = (H5DT_INT8 *)in->data;
+ for (i = 0; i < len; i++, in08++) {
+ if (HDfread((char *)in08, sizeof(H5DT_INT8), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
#ifdef H5DEBUGIMPORT
- HDprintf("readIntegerData %d (0x%.8X)\n", *in08, *in08);
+ HDprintf("readIntegerData %d (0x%.8X)\n", *in08, *in08);
#endif
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ }
+ break;
- case 16:
- in16 = (H5DT_INT16 *) in->data;
- switch (in->inputClass) {
- case 0: /* TEXTIN */
- for (i = 0; i < len; i++, in16++) {
- if (fscanf(strm, "%hd", in16) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
}
- in16 = (H5DT_INT16 *) in->data;
break;
- case 4: /* IN */
- for (i = 0; i < len; i++, in16++) {
- if (HDfread((char *)&temp16, sizeof(H5DT_INT16), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *in16 = swap_int16(temp16);
- else
-*/
- *in16 = temp16;
+ case 16:
+ in16 = (H5DT_INT16 *)in->data;
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ for (i = 0; i < len; i++, in16++) {
+ if (fscanf(strm, "%hd", in16) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ in16 = (H5DT_INT16 *)in->data;
+ break;
+
+ case 4: /* IN */
+ for (i = 0; i < len; i++, in16++) {
+ if (HDfread((char *)&temp16, sizeof(H5DT_INT16), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *in16 = swap_int16(temp16);
+ else
+ */
+ *in16 = temp16;
#ifdef H5DEBUGIMPORT
- HDprintf("readIntegerData %d (0x%.8X)\n", *in16, temp16);
+ HDprintf("readIntegerData %d (0x%.8X)\n", *in16, temp16);
#endif
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ }
+ break;
- case 32:
- in32 = (H5DT_INT32 *) in->data;
- switch (in->inputClass) {
- case 0: /* TEXTIN */
- for (i = 0; i < len; i++, in32++) {
- if (fscanf(strm, "%d", in32) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
}
break;
- case 4: /* IN */
- for (i = 0; i < len; i++, in32++) {
- if (HDfread((char *)&temp32, sizeof(H5DT_INT32), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *in32 = swap_int32(temp32);
- else
-*/
- *in32 = temp32;
+ case 32:
+ in32 = (H5DT_INT32 *)in->data;
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ for (i = 0; i < len; i++, in32++) {
+ if (fscanf(strm, "%d", in32) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ case 4: /* IN */
+ for (i = 0; i < len; i++, in32++) {
+ if (HDfread((char *)&temp32, sizeof(H5DT_INT32), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *in32 = swap_int32(temp32);
+ else
+ */
+ *in32 = temp32;
#ifdef H5DEBUGIMPORT
- HDprintf("readIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32);
+ HDprintf("readIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32);
#endif
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ }
+ break;
-#ifdef H5_SIZEOF_LONG_LONG
- case 64:
- in64 = (H5DT_INT64 *) in->data;
- switch (in->inputClass) {
- case 0: /* TEXTIN */
- for (i = 0; i < len; i++, in64++) {
- if (fscanf(strm, "%s", buffer) < 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
- *in64 = (H5DT_INT64) HDstrtoll(buffer, NULL, 10);
}
break;
- case 4: /* IN */
- for (i = 0; i < len; i++, in64++) {
- if (HDfread((char *)&temp64, sizeof(H5DT_INT64), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *in64 = swap_int64(temp64);
- else
-*/
- *in64 = temp64;
+#ifdef H5_SIZEOF_LONG_LONG
+ case 64:
+ in64 = (H5DT_INT64 *)in->data;
+ switch (in->inputClass) {
+ case 0: /* TEXTIN */
+ for (i = 0; i < len; i++, in64++) {
+ if (fscanf(strm, "%s", buffer) < 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ *in64 = (H5DT_INT64)HDstrtoll(buffer, NULL, 10);
+ }
+ break;
+
+ case 4: /* IN */
+ for (i = 0; i < len; i++, in64++) {
+ if (HDfread((char *)&temp64, sizeof(H5DT_INT64), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *in64 = swap_int64(temp64);
+ else
+ */
+ *in64 = temp64;
#ifdef H5DEBUGIMPORT
- HDprintf("readIntegerData %d (0x%.8X)\n", *in64, temp64);
+ HDprintf("readIntegerData %d (0x%.8X)\n", *in64, temp64);
#endif
+ }
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
}
break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
#endif /* ifdef H5_SIZEOF_LONG_LONG */
- default:
- (void) HDfprintf(stderr, "%s", err3);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ break;
}
return (0);
}
-static int readUIntegerData(FILE *strm, struct Input *in)
+static int
+readUIntegerData(FILE *strm, struct Input *in)
{
- H5DT_UINT8 *in08;
+ H5DT_UINT8 * in08;
H5DT_UINT16 *in16;
H5DT_UINT16 temp16;
H5DT_UINT32 *in32;
@@ -642,7 +646,7 @@ static int readUIntegerData(FILE *strm, struct Input *in)
#ifdef H5_SIZEOF_LONG_LONG
H5DT_UINT64 *in64;
H5DT_UINT64 temp64;
- char buffer[256];
+ char buffer[256];
#endif
hsize_t len = 1;
hsize_t i;
@@ -655,161 +659,162 @@ static int readUIntegerData(FILE *strm, struct Input *in)
len *= in->sizeOfDimension[j];
switch (in->inputSize) {
- case 8:
- switch (in->inputClass) {
- case 6: /* TEXTUIN */
- in08 = (H5DT_UINT8 *) in->data;
- for (i = 0; i < len; i++, in08++) {
- if (fscanf(strm, "%hu", &temp16) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- (*in08) = (H5DT_UINT8) temp16;
- }
- break;
-
- case 7: /* UIN */
- in08 = (H5DT_UINT8 *) in->data;
- for (i = 0; i < len; i++, in08++) {
- if (HDfread((char *) in08, sizeof(H5DT_UINT8), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- }
- break;
+ case 8:
+ switch (in->inputClass) {
+ case 6: /* TEXTUIN */
+ in08 = (H5DT_UINT8 *)in->data;
+ for (i = 0; i < len; i++, in08++) {
+ if (fscanf(strm, "%hu", &temp16) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ (*in08) = (H5DT_UINT8)temp16;
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ case 7: /* UIN */
+ in08 = (H5DT_UINT8 *)in->data;
+ for (i = 0; i < len; i++, in08++) {
+ if (HDfread((char *)in08, sizeof(H5DT_UINT8), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
- case 16:
- in16 = (H5DT_UINT16 *) in->data;
- switch (in->inputClass) {
- case 6: /* TEXTUIN */
- for (i = 0; i < len; i++, in16++) {
- if (fscanf(strm, "%hu", in16) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
}
break;
- case 7: /* UIN */
- for (i = 0; i < len; i++, in16++) {
- if (HDfread((char *)&temp16, sizeof(H5DT_UINT16), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *in16 = swap_uint16(temp16);
- else
-*/
- *in16 = temp16;
+ case 16:
+ in16 = (H5DT_UINT16 *)in->data;
+ switch (in->inputClass) {
+ case 6: /* TEXTUIN */
+ for (i = 0; i < len; i++, in16++) {
+ if (fscanf(strm, "%hu", in16) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ case 7: /* UIN */
+ for (i = 0; i < len; i++, in16++) {
+ if (HDfread((char *)&temp16, sizeof(H5DT_UINT16), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *in16 = swap_uint16(temp16);
+ else
+ */
+ *in16 = temp16;
#ifdef H5DEBUGIMPORT
- HDprintf("readUIntegerData %d (0x%.4X = 0x%.4X)\n", *in16, *in16, temp16);
+ HDprintf("readUIntegerData %d (0x%.4X = 0x%.4X)\n", *in16, *in16, temp16);
#endif
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ }
+ break;
- case 32:
- in32 = (H5DT_UINT32 *) in->data;
- switch (in->inputClass) {
- case 6: /* TEXTUIN */
- for (i = 0; i < len; i++, in32++) {
- if (fscanf(strm, "%u", in32) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
}
break;
- case 7: /* UIN */
- for (i = 0; i < len; i++, in32++) {
- if (HDfread((char *)&temp32, sizeof(H5DT_UINT32), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *in32 = swap_uint32(temp32);
- else
-*/
- *in32 = temp32;
+ case 32:
+ in32 = (H5DT_UINT32 *)in->data;
+ switch (in->inputClass) {
+ case 6: /* TEXTUIN */
+ for (i = 0; i < len; i++, in32++) {
+ if (fscanf(strm, "%u", in32) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+ break;
+
+ case 7: /* UIN */
+ for (i = 0; i < len; i++, in32++) {
+ if (HDfread((char *)&temp32, sizeof(H5DT_UINT32), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *in32 = swap_uint32(temp32);
+ else
+ */
+ *in32 = temp32;
#ifdef H5DEBUGIMPORT
- HDprintf("readUIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32);
+ HDprintf("readUIntegerData %d (0x%.8X = 0x%.8X)\n", *in32, *in32, temp32);
#endif
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ }
+ break;
-#ifdef H5_SIZEOF_LONG_LONG
- case 64:
- in64 = (H5DT_UINT64 *) in->data;
- switch (in->inputClass) {
- case 6: /* TEXTUIN */
- for (i = 0; i < len; i++, in64++) {
- if (fscanf(strm, "%s", buffer) < 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
- *in64 = (H5DT_UINT64) HDstrtoll(buffer, NULL, 10);
}
break;
- case 7: /* UIN */
- for (i = 0; i < len; i++, in64++) {
- if (HDfread((char *)&temp64, sizeof(H5DT_UINT64), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *in64 = swap_uint64(temp64);
- else
-*/
- *in64 = temp64;
+#ifdef H5_SIZEOF_LONG_LONG
+ case 64:
+ in64 = (H5DT_UINT64 *)in->data;
+ switch (in->inputClass) {
+ case 6: /* TEXTUIN */
+ for (i = 0; i < len; i++, in64++) {
+ if (fscanf(strm, "%s", buffer) < 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ *in64 = (H5DT_UINT64)HDstrtoll(buffer, NULL, 10);
+ }
+ break;
+
+ case 7: /* UIN */
+ for (i = 0; i < len; i++, in64++) {
+ if (HDfread((char *)&temp64, sizeof(H5DT_UINT64), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *in64 = swap_uint64(temp64);
+ else
+ */
+ *in64 = temp64;
#ifdef H5DEBUGIMPORT
- HDprintf("readUIntegerData %ld (0x%.8X = 0x%.8X)\n", *in64, *in64, temp64);
+ HDprintf("readUIntegerData %ld (0x%.8X = 0x%.8X)\n", *in64, *in64, temp64);
#endif
+ }
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
}
break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
#endif /* ifdef H5_SIZEOF_LONG_LONG */
- default:
- (void) HDfprintf(stderr, "%s", err3);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ break;
}
return (0);
}
-static int readFloatData(FILE *strm, struct Input *in)
+static int
+readFloatData(FILE *strm, struct Input *in)
{
H5DT_FLOAT32 *fp32;
- uint32_t *bfp32;
- uint32_t temp32;
+ uint32_t * bfp32;
+ uint32_t temp32;
H5DT_FLOAT64 *fp64;
- uint64_t *bfp64;
- uint64_t temp64;
+ uint64_t * bfp64;
+ uint64_t temp64;
hsize_t len = 1;
hsize_t i;
@@ -822,113 +827,113 @@ static int readFloatData(FILE *strm, struct Input *in)
len *= in->sizeOfDimension[j];
switch (in->inputSize) {
- case 32:
- fp32 = (H5DT_FLOAT32 *) in->data;
- switch (in->inputClass) {
- case 1: /* TEXTFP */
- for (i = 0; i < len; i++, fp32++) {
- if (fscanf(strm, "%f", fp32) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- }
+ case 32:
+ fp32 = (H5DT_FLOAT32 *)in->data;
+ switch (in->inputClass) {
+ case 1: /* TEXTFP */
+ for (i = 0; i < len; i++, fp32++) {
+ if (fscanf(strm, "%f", fp32) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
- fp32 = (H5DT_FLOAT32 *) in->data;
- break;
+ fp32 = (H5DT_FLOAT32 *)in->data;
+ break;
- /* same as TEXTFP */
- case 2: /*TEXTFPE */
+ /* same as TEXTFP */
+ case 2: /*TEXTFPE */
- for (i = 0; i < len; i++, fp32++) {
- if (fscanf(strm, "%f", fp32) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- }
+ for (i = 0; i < len; i++, fp32++) {
+ if (fscanf(strm, "%f", fp32) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
- fp32 = (H5DT_FLOAT32 *) in->data;
- break;
+ fp32 = (H5DT_FLOAT32 *)in->data;
+ break;
- case 3: /* FP */
- bfp32 = (uint32_t *) in->data;
- for (i = 0; i < len; i++, bfp32++) {
- if (HDfread((char *)&temp32, sizeof(uint32_t), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *bfp32 = swap_uint32(temp32);
- else
-*/
- *bfp32 = temp32;
+ case 3: /* FP */
+ bfp32 = (uint32_t *)in->data;
+ for (i = 0; i < len; i++, bfp32++) {
+ if (HDfread((char *)&temp32, sizeof(uint32_t), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *bfp32 = swap_uint32(temp32);
+ else
+ */
+ *bfp32 = temp32;
#ifdef H5DEBUGIMPORT
- HDprintf("readFloatData %ld (0x%.8X = 0x%.8X)\n", *bfp32, *bfp32, temp32);
+ HDprintf("readFloatData %ld (0x%.8X = 0x%.8X)\n", *bfp32, *bfp32, temp32);
#endif
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
+ }
+ break;
- case 64:
- fp64 = (H5DT_FLOAT64 *) in->data;
- switch (in->inputClass) {
- case 1: /* TEXTFP */
- for (i = 0; i < len; i++, fp64++) {
- if (fscanf(strm, "%lf", fp64) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
}
-
- fp64 = (H5DT_FLOAT64 *) in->data;
break;
- /* same as TEXTFP */
- case 2: /*TEXTFPE */
+ case 64:
+ fp64 = (H5DT_FLOAT64 *)in->data;
+ switch (in->inputClass) {
+ case 1: /* TEXTFP */
+ for (i = 0; i < len; i++, fp64++) {
+ if (fscanf(strm, "%lf", fp64) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
+
+ fp64 = (H5DT_FLOAT64 *)in->data;
+ break;
- for (i = 0; i < len; i++, fp64++) {
- if (fscanf(strm, "%lf", fp64) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- }
+ /* same as TEXTFP */
+ case 2: /*TEXTFPE */
- fp64 = (H5DT_FLOAT64 *) in->data;
- break;
+ for (i = 0; i < len; i++, fp64++) {
+ if (fscanf(strm, "%lf", fp64) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ }
- case 3: /* FP */
- bfp64 = (uint64_t *) in->data;
- for (i = 0; i < len; i++, bfp64++) {
- if (HDfread((char *)&temp64, sizeof(uint64_t), 1, strm) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
-/*
- if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
- *bfp64 = swap_uint64(temp64);
- else
-*/
- *bfp64 = temp64;
+ fp64 = (H5DT_FLOAT64 *)in->data;
+ break;
+
+ case 3: /* FP */
+ bfp64 = (uint64_t *)in->data;
+ for (i = 0; i < len; i++, bfp64++) {
+ if (HDfread((char *)&temp64, sizeof(uint64_t), 1, strm) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ /*
+ if (in-> h5dumpInput && (in->inputByteOrder != in->outputByteOrder))
+ *bfp64 = swap_uint64(temp64);
+ else
+ */
+ *bfp64 = temp64;
#ifdef H5DEBUGIMPORT
- HDprintf("readFloatData %ld (0x%.16lX)\n", *bfp64, temp64);
+ HDprintf("readFloatData %ld (0x%.16lX)\n", *bfp64, temp64);
#endif
+ }
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
}
break;
default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err3);
- break;
+ (void)HDfprintf(stderr, "%s", err3);
+ break;
}
return (0);
}
@@ -947,7 +952,8 @@ static int readFloatData(FILE *strm, struct Input *in)
*
*-------------------------------------------------------------------------
*/
-static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
+static int
+processStrData(FILE *strm, struct Input *in, hid_t file_id)
{
hid_t group_id;
hid_t dset_id;
@@ -968,8 +974,8 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
*-------------------------------------------------------------------------
*/
- while(EOF != (c = HDfgetc(strm)))
- if (c == 10) /* eol */
+ while (EOF != (c = HDfgetc(strm)))
+ if (c == 10) /* eol */
nlines++;
if (!nlines)
@@ -997,13 +1003,14 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
{
/* create parent groups */
if (in->path.count > 1) {
- j = 0;
+ j = 0;
handle = file_id;
while (j < in->path.count - 1) {
if ((group_id = H5Gopen2(handle, in->path.group[j], H5P_DEFAULT)) < 0) {
group_id = H5Gcreate2(handle, in->path.group[j++], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for (; j < in->path.count - 1; j++)
- group_id = H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group_id =
+ H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
handle = group_id;
break;
}
@@ -1013,7 +1020,7 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
}
else {
handle = file_id;
- j = 0;
+ j = 0;
}
/*enable error reporting */
@@ -1026,21 +1033,22 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
if ((mspace_id = H5Screate(H5S_SCALAR)) < 0)
goto out;
- if ((dset_id = H5Dcreate2(handle, in->path.group[j], type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2(handle, in->path.group[j], type_id, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto out;
line = 0;
- while(EOF != (c = HDfgetc(strm))) {
+ while (EOF != (c = HDfgetc(strm))) {
str[i] = (char)c;
i++;
if (c == 10) { /* eol */
- char *str2 = str;
- hid_t fspace_id;
+ char * str2 = str;
+ hid_t fspace_id;
hsize_t start[1];
- hsize_t count[1] = { 1 };
+ hsize_t count[1] = {1};
str[i - 1] = '\0'; /* terminate string */
@@ -1058,9 +1066,8 @@ static int processStrData(FILE *strm, struct Input *in, hid_t file_id)
if (H5Sclose(fspace_id) < 0)
goto out;
- i = 0;
+ i = 0;
str[0] = '\0';
-
}
}
@@ -1087,20 +1094,21 @@ out:
*
*-------------------------------------------------------------------------
*/
-static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
+static int
+processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
{
- hid_t group_id = H5I_INVALID_HID;
- hid_t dset_id = H5I_INVALID_HID;
- hid_t space_id = H5I_INVALID_HID;
- hid_t mspace_id = H5I_INVALID_HID;
- hid_t type_id = H5I_INVALID_HID;
- hid_t handle = H5I_INVALID_HID;
- char *str1 = NULL;
- char *str2 = NULL;
- char *str3 = NULL;
- char str[1024] = "";
+ hid_t group_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t mspace_id = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ hid_t handle = H5I_INVALID_HID;
+ char * str1 = NULL;
+ char * str2 = NULL;
+ char * str3 = NULL;
+ char str[1024] = "";
int j;
- hsize_t line;
+ hsize_t line;
/*-------------------------------------------------------------------------
* read file and generate an HDF5 dataset
@@ -1121,13 +1129,14 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
{
/* create parent groups */
if (in->path.count > 1) {
- j = 0;
+ j = 0;
handle = file_id;
while (j < in->path.count - 1) {
if ((group_id = H5Gopen2(handle, in->path.group[j], H5P_DEFAULT)) < 0) {
group_id = H5Gcreate2(handle, in->path.group[j++], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for (; j < in->path.count - 1; j++)
- group_id = H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group_id =
+ H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
handle = group_id;
break;
}
@@ -1137,7 +1146,7 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
}
else {
handle = file_id;
- j = 0;
+ j = 0;
}
/*enable error reporting */
@@ -1153,67 +1162,69 @@ static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
if ((mspace_id = H5Screate(H5S_SCALAR)) < 0)
goto out;
- if ((dset_id = H5Dcreate2(handle, in->path.group[j], type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((dset_id = H5Dcreate2(handle, in->path.group[j], type_id, space_id, H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
goto out;
#ifdef H5DEBUGIMPORT
HDprintf("processStrHDFData DATATYPE STRING ready to process strings\n");
#endif
line = 0;
- j = 0;
+ j = 0;
- while (HDfgets(str,sizeof(str),strm)) {
+ while (HDfgets(str, sizeof(str), strm)) {
str1 = str;
str2 = NULL;
str3 = NULL;
#ifdef H5DEBUGIMPORT
- HDprintf("processStrHDFData DATATYPE STRING[%llu]={%s}\n", (unsigned long long)line, str1);
+ HDprintf("processStrHDFData DATATYPE STRING[%llu]={%s}\n", (unsigned long long)line, str1);
#endif
- /* process string to remove the first and last quote char */
- str2 = strchr(str1, '"');
- if (str2 != NULL) {
+ /* process string to remove the first and last quote char */
+ str2 = strchr(str1, '"');
+ if (str2 != NULL) {
#ifdef H5DEBUGIMPORT
- HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2);
+ HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2);
#endif
- str2++;
+ str2++;
#ifdef H5DEBUGIMPORT
- HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2);
+ HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2);
#endif
- str3 = strrchr(str2, '"');
- if (str3 != NULL) {
+ str3 = strrchr(str2, '"');
+ if (str3 != NULL) {
#ifdef H5DEBUGIMPORT
- HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str3), str3);
+ HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str3), str3);
#endif
- *str3 = '\0';
+ *str3 = '\0';
#ifdef H5DEBUGIMPORT
- HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2);
+ HDprintf("processStrHDFData DATATYPE STRING len:%d for {%s}\n", HDstrlen(str2), str2);
#endif
- if(HDstrlen(str2) > 0) {
- hid_t fspace_id;
- hsize_t start[1];
- hsize_t count[1] = { 1 };
+ if (HDstrlen(str2) > 0) {
+ hid_t fspace_id;
+ hsize_t start[1];
+ hsize_t count[1] = {1};
#ifdef H5DEBUGIMPORT
- HDprintf("processStrHDFData DATATYPE STRING[%llu] store %s\n", (unsigned long long)line, str2);
+ HDprintf("processStrHDFData DATATYPE STRING[%llu] store %s\n", (unsigned long long)line,
+ str2);
#endif
- if ((fspace_id = H5Dget_space(dset_id)) < 0)
- goto out;
+ if ((fspace_id = H5Dget_space(dset_id)) < 0)
+ goto out;
- start[0] = line++;
+ start[0] = line++;
- if (H5Sselect_hyperslab(fspace_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
- goto out;
+ if (H5Sselect_hyperslab(fspace_id, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ goto out;
- if (H5Dwrite(dset_id, type_id, mspace_id, fspace_id, H5P_DEFAULT, &str2) < 0)
- goto out;
+ if (H5Dwrite(dset_id, type_id, mspace_id, fspace_id, H5P_DEFAULT, &str2) < 0)
+ goto out;
- if (H5Sclose(fspace_id) < 0)
- goto out;
- }
+ if (H5Sclose(fspace_id) < 0)
+ goto out;
}
}
+ }
str[0] = '\0';
j++;
}
@@ -1233,21 +1244,22 @@ out:
#ifdef H5DEBUGIMPORT
HDprintf("processStrHDFData DATATYPE STRING error exit\n");
#endif
-/* disable error reporting */
-H5E_BEGIN_TRY
-{
- /* close */
- H5Dclose(dset_id);
- H5Sclose(space_id);
- H5Sclose(mspace_id);
- H5Tclose(type_id);
-}
-H5E_END_TRY;
+ /* disable error reporting */
+ H5E_BEGIN_TRY
+ {
+ /* close */
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
+ H5Sclose(mspace_id);
+ H5Tclose(type_id);
+ }
+ H5E_END_TRY;
return (-1);
}
-static int allocateIntegerStorage(struct Input *in)
+static int
+allocateIntegerStorage(struct Input *in)
{
hsize_t len = 1;
int j;
@@ -1258,44 +1270,45 @@ static int allocateIntegerStorage(struct Input *in)
len *= in->sizeOfDimension[j];
switch (in->inputSize) {
- case 8:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT8))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 8:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_INT8))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 16:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT16))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 16:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_INT16))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 32:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT32))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 32:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_INT32))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 64:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT64))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 64:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_INT64))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ break;
}
return (0);
}
-static int allocateUIntegerStorage(struct Input *in)
+static int
+allocateUIntegerStorage(struct Input *in)
{
- hsize_t len = 1;
+ hsize_t len = 1;
const char *err1 = "Unable to allocate dynamic memory.\n";
const char *err2 = "Invalid storage size for unsigned integer input data.\n";
int j;
@@ -1304,42 +1317,43 @@ static int allocateUIntegerStorage(struct Input *in)
len *= in->sizeOfDimension[j];
switch (in->inputSize) {
- case 8:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT8))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 8:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_UINT8))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 16:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT16))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 16:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_UINT16))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 32:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT32))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 32:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_UINT32))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 64:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT64))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 64:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_UINT64))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ break;
}
return (0);
}
-static int allocateFloatStorage(struct Input *in)
+static int
+allocateFloatStorage(struct Input *in)
{
hsize_t len = 1;
int j;
@@ -1350,54 +1364,55 @@ static int allocateFloatStorage(struct Input *in)
len *= in->sizeOfDimension[j];
switch (in->inputSize) {
- case 32:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_FLOAT32))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 32:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_FLOAT32))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- case 64:
- if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_FLOAT64))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- break;
+ case 64:
+ if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_FLOAT64))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ break;
}
return (0);
}
-static int processConfigurationFile(char *infile, struct Input *in)
+static int
+processConfigurationFile(char *infile, struct Input *in)
{
- FILE *strm = NULL;
- char key[MAX_PATH_NAME_LENGTH];
- int kindex;
- char temp[MAX_PATH_NAME_LENGTH];
- int ival;
- int scanret;
- int retval = -1;
-
- const char *err1 = "Unable to open the configuration file: %s for reading.\n";
- const char *err2 = "Unknown keyword: %s in configuration file: %s\n";
- const char *err3a = "PATH keyword appears twice in %s.\n";
- const char *err3b = "Error in parsing the path information from %s.\n";
- const char *err4a = "INPUT-CLASS keyword appears twice in %s.\n";
- const char *err4b = "Error in retrieving the input class from %s.\n";
- const char *err5a = "INPUT-SIZE keyword appears twice in %s.\n";
- const char *err5b = "Error in retrieving the input size from %s.\n";
- const char *err6a = "RANK keyword appears twice in %s.\n";
- const char *err6b = "Error in retrieving the rank from %s.\n";
- const char *err7a = "DIMENSION-SIZES keyword appears twice in %s.\n";
- const char *err7b = "DIMENSION-SIZES cannot appear before RANK is provided.\n";
- const char *err7c = "Error in retrieving the dimension sizes from %s.\n";
- const char *err8a = "OUTPUT-CLASS keyword appears twice in %s.\n";
- const char *err8b = "Error in retrieving the output class from %s.\n";
- const char *err9a = "OUTPUT-SIZE keyword appears twice in %s.\n";
- const char *err9b = "Error in retrieving the output size from %s.\n";
+ FILE *strm = NULL;
+ char key[MAX_PATH_NAME_LENGTH];
+ int kindex;
+ char temp[MAX_PATH_NAME_LENGTH];
+ int ival;
+ int scanret;
+ int retval = -1;
+
+ const char *err1 = "Unable to open the configuration file: %s for reading.\n";
+ const char *err2 = "Unknown keyword: %s in configuration file: %s\n";
+ const char *err3a = "PATH keyword appears twice in %s.\n";
+ const char *err3b = "Error in parsing the path information from %s.\n";
+ const char *err4a = "INPUT-CLASS keyword appears twice in %s.\n";
+ const char *err4b = "Error in retrieving the input class from %s.\n";
+ const char *err5a = "INPUT-SIZE keyword appears twice in %s.\n";
+ const char *err5b = "Error in retrieving the input size from %s.\n";
+ const char *err6a = "RANK keyword appears twice in %s.\n";
+ const char *err6b = "Error in retrieving the rank from %s.\n";
+ const char *err7a = "DIMENSION-SIZES keyword appears twice in %s.\n";
+ const char *err7b = "DIMENSION-SIZES cannot appear before RANK is provided.\n";
+ const char *err7c = "Error in retrieving the dimension sizes from %s.\n";
+ const char *err8a = "OUTPUT-CLASS keyword appears twice in %s.\n";
+ const char *err8b = "Error in retrieving the output class from %s.\n";
+ const char *err9a = "OUTPUT-SIZE keyword appears twice in %s.\n";
+ const char *err9b = "Error in retrieving the output size from %s.\n";
const char *err10a = "OUTPUT-ARCHITECTURE keyword appears twice in %s.\n";
const char *err10b = "Error in retrieving the output architecture from %s.\n";
const char *err11a = "OUTPUT-BYTE-ORDER keyword appears twice in %s.\n";
@@ -1417,10 +1432,10 @@ static int processConfigurationFile(char *infile, struct Input *in)
const char *err16a = "MAXIMUM-DIMENSIONS keyword appears twice in %s.\n";
const char *err16b = "MAXIMUM-DIMENSIONS cannot appear before DIMENSION-SIZES are provided.\n";
const char *err16c = "Error in retrieving the maximum dimension sizes from %s.\n";
- const char *err17 = "Configuration parameters are invalid in %s.\n";
- const char *err18 = "Unable to get string value.\n";
- const char *err19 = "Unable to get integer value.\n";
- const char *err20 = "Unable to get subset values.\n";
+ const char *err17 = "Configuration parameters are invalid in %s.\n";
+ const char *err18 = "Unable to get string value.\n";
+ const char *err19 = "Unable to get integer value.\n";
+ const char *err20 = "Unable to get subset values.\n";
/* create vector to map which keywords have been found
check vector after each keyword to check for violation
@@ -1429,17 +1444,17 @@ static int processConfigurationFile(char *infile, struct Input *in)
*/
/* Initialize machine endian */
- volatile uint32_t ibyte=0x01234567;
+ volatile uint32_t ibyte = 0x01234567;
/* 0 for big endian, 1 for little endian. */
- if ((*((volatile uint8_t*)(&ibyte))) == 0x67) {
+ if ((*((volatile uint8_t *)(&ibyte))) == 0x67) {
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err11e);
+ (void)HDfprintf(stderr, "%s", err11e);
return (-1);
}
}
else {
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err11e);
+ (void)HDfprintf(stderr, "%s", err11e);
return (-1);
}
}
@@ -1450,64 +1465,64 @@ static int processConfigurationFile(char *infile, struct Input *in)
in->inputArchitecture = 0; /* default to NATIVE */
if ((strm = HDfopen(infile, "r")) == NULL) {
- (void) HDfprintf(stderr, err1, infile);
+ (void)HDfprintf(stderr, err1, infile);
goto error;
}
scanret = fscanf(strm, "%254s", key);
- if((scanret == 1) && !HDstrcmp("HDF5", key)) {
+ if ((scanret == 1) && !HDstrcmp("HDF5", key)) {
#ifdef H5DEBUGIMPORT
int pndx;
HDprintf("\nh5dump file\n");
#endif
in->h5dumpInput = 1;
- scanret = fscanf(strm, "%254s", temp); /* filename */
- scanret = fscanf(strm, "%254s", temp); /* start bracket */
- scanret = fscanf(strm, "%254s", key); /* DATASET */
+ scanret = fscanf(strm, "%254s", temp); /* filename */
+ scanret = fscanf(strm, "%254s", temp); /* start bracket */
+ scanret = fscanf(strm, "%254s", key); /* DATASET */
while (scanret == 1) {
- if(!HDstrcmp("DATASET", key)) { /* PATH */
+ if (!HDstrcmp("DATASET", key)) { /* PATH */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASET key\n");
#endif
if (in->configOptionVector[PATH] == 1) {
- (void) HDfprintf(stderr, err3a, infile);
+ (void)HDfprintf(stderr, err3a, infile);
goto error;
}
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASET %s found\n", temp);
#endif
if (parsePathInfo(&in->path, temp) == -1) {
- (void) HDfprintf(stderr, err3b, infile);
+ (void)HDfprintf(stderr, err3b, infile);
goto error;
}
in->configOptionVector[PATH] = 1;
- scanret = fscanf(strm, "%254s", temp); /* start bracket */
+ scanret = fscanf(strm, "%254s", temp); /* start bracket */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASET %s found\n", temp);
#endif
- } /* if(!HDstrcmp("DATASET", key)) PATH */
- else if(!HDstrcmp("DATATYPE", key)) { /* INPUT-CLASS */
+ } /* if(!HDstrcmp("DATASET", key)) PATH */
+ else if (!HDstrcmp("DATATYPE", key)) { /* INPUT-CLASS */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE key\n");
#endif
if (in->configOptionVector[INPUT_CLASS] == 1) {
- (void) HDfprintf(stderr, err4a, infile);
+ (void)HDfprintf(stderr, err4a, infile);
goto error;
}
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE %s found\n", temp);
#endif
if ((kindex = getInputClassType(in, temp)) == -1) {
- (void) HDfprintf(stderr, err4b, infile);
+ (void)HDfprintf(stderr, err4b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1520,8 +1535,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
if (in->configOptionVector[OUTPUT_CLASS] == 0) {
if (in->inputClass == 0 || in->inputClass == 4)
in->outputClass = 0;
- if (in->inputClass == 1 || in->inputClass == 2
- || in->inputClass == 3)
+ if (in->inputClass == 1 || in->inputClass == 2 || in->inputClass == 3)
in->outputClass = 1;
if (in->inputClass == 6 || in->inputClass == 7)
in->outputClass = 2;
@@ -1530,27 +1544,27 @@ static int processConfigurationFile(char *infile, struct Input *in)
HDprintf("h5dump DATATYPE type %d outputClass\n", in->outputClass);
#endif
- if(in->inputClass == 5) { /* STRING */
+ if (in->inputClass == 5) { /* STRING */
int get_next_prop = 1;
- in->outputClass = -1;
+ in->outputClass = -1;
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING found\n");
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING %s found\n", temp);
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* string properties */
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
while (get_next_prop) {
- if(!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */
+ if (!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err19);
+ (void)HDfprintf(stderr, "%s", err19);
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1558,9 +1572,9 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
if (HDstrcmp("H5T_VARIABLE;", temp)) {
char *more = temp;
- ival = (int)HDstrtol(more, &more, 10);
+ ival = (int)HDstrtol(more, &more, 10);
if (getInputSize(in, ival) == -1) {
- (void) HDfprintf(stderr, err5b, infile);
+ (void)HDfprintf(stderr, err5b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1568,28 +1582,27 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
}
}
- else if(!HDstrcmp("STRPAD", temp)) { /* STRPAD */
+ else if (!HDstrcmp("STRPAD", temp)) { /* STRPAD */
if (fscanf(strm, "%254s", temp) != 1) { /* STRPAD type */
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING STRPAD %s found\n", temp);
#endif
}
- else if(!HDstrcmp("CSET", key)) { /* CSET */
+ else if (!HDstrcmp("CSET", key)) { /* CSET */
if (fscanf(strm, "%254s", temp) != 1) { /* CSET type */
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING CSET %s found\n", temp);
#endif
-
}
- else if(!HDstrcmp("CTYPE", temp)) { /* CTYPE */
+ else if (!HDstrcmp("CTYPE", temp)) { /* CTYPE */
if (fscanf(strm, "%254s", temp) != 1) { /* CTYPE type */
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1597,90 +1610,91 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
} /* if(!HDstrcmp("CSET", key)) */
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING %s found\n", temp);
#endif
- if(!HDstrcmp("}", temp)) { /* end bracket */
+ if (!HDstrcmp("}", temp)) { /* end bracket */
get_next_prop = 0;
}
- } /* while (get_next_prop) */
- } /* if(kindex == 5) STRING */
- } /* else if(!HDstrcmp("DATATYPE", key)) INPUT-CLASS */
- else if(!HDstrcmp("DATASPACE", key)) { /* RANK and DIMENSIONS */
- hsize_t temp_dims[MAX_NUM_DIMENSION];
+ } /* while (get_next_prop) */
+ } /* if(kindex == 5) STRING */
+ } /* else if(!HDstrcmp("DATATYPE", key)) INPUT-CLASS */
+ else if (!HDstrcmp("DATASPACE", key)) { /* RANK and DIMENSIONS */
+ hsize_t temp_dims[MAX_NUM_DIMENSION];
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE key\n");
#endif
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
- if(!HDstrcmp("SCALAR", temp)) { /* SCALAR */
+ if (!HDstrcmp("SCALAR", temp)) { /* SCALAR */
in->rank = 0;
- } /* if(!HDstrcmp("SCALAR", key)) */
- else if(!HDstrcmp("NULL", temp)) { /* NULL */
- (void) HDfprintf(stderr, err6b, infile);
+ } /* if(!HDstrcmp("SCALAR", key)) */
+ else if (!HDstrcmp("NULL", temp)) { /* NULL */
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
- } /* else if(!HDstrcmp("NULL", key)) */
- else if(!HDstrcmp("SIMPLE", temp)) { /* SIMPLE */
+ } /* else if(!HDstrcmp("NULL", key)) */
+ else if (!HDstrcmp("SIMPLE", temp)) { /* SIMPLE */
int icount = 0;
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE found\n");
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
- if(!HDstrcmp("(", temp)) { /* start paren */
+ if (!HDstrcmp("(", temp)) { /* start paren */
int get_next_dim = 1;
- int i = 0;
+ int i = 0;
if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
- (void) HDfprintf(stderr, err16c, infile);
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
while (get_next_dim) {
- char *more = temp;
+ char *more = temp;
temp_dims[icount] = HDstrtoull(more, &more, 10);
if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
- if(!HDstrcmp(")", temp)) { /* end paren */
- in->rank = ++icount;
+ if (!HDstrcmp(")", temp)) { /* end paren */
+ in->rank = ++icount;
in->configOptionVector[RANK] = 1;
- get_next_dim = 0;
+ get_next_dim = 0;
}
else { /* Dimension */
icount++;
if (icount > MAX_NUM_DIMENSION) {
- (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ (void)HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
}
} /* while (get_next_dim) */
- if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ if ((in->sizeOfDimension = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) ==
+ NULL) {
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1699,36 +1713,37 @@ static int processConfigurationFile(char *infile, struct Input *in)
in->configOptionVector[DIM] = 1;
} /* if(!HDstrcmp("(", key)) start paren */
else {
- (void) HDfprintf(stderr, err5b, infile);
+ (void)HDfprintf(stderr, err5b, infile);
goto error;
}
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
- if(!HDstrcmp("/", temp)) { /* / max dims */
- if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
+ if (!HDstrcmp("/", temp)) { /* / max dims */
+ if ((in->maxsizeOfDimension =
+ (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) {
goto error;
}
if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
- if(!HDstrcmp("(", temp)) { /* start paren */
+ if (!HDstrcmp("(", temp)) { /* start paren */
int get_next_dim = 1;
- int i = 0;
+ int i = 0;
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE process max dim values\n");
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* max dim with optional comma */
- (void) HDfprintf(stderr, err16c, infile);
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1738,28 +1753,29 @@ static int processConfigurationFile(char *infile, struct Input *in)
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE get max dim value\n");
#endif
- if(!HDstrcmp("H5S_UNLIMITED", temp) || !HDstrcmp("H5S_UNLIMITED,", temp)) { /* unlimited */
- in->maxsizeOfDimension[i] = H5S_UNLIMITED;
+ if (!HDstrcmp("H5S_UNLIMITED", temp) ||
+ !HDstrcmp("H5S_UNLIMITED,", temp)) { /* unlimited */
+ in->maxsizeOfDimension[i] = H5S_UNLIMITED;
in->configOptionVector[EXTEND] = 1;
}
else {
- char *more = temp;
+ char *more = temp;
in->maxsizeOfDimension[i] = HDstrtoull(more, &more, 10);
}
if (fscanf(strm, "%254s", temp) != 1) { /* max dim or end paren */
- (void) HDfprintf(stderr, err16c, infile);
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
- if(!HDstrcmp(")", temp)) { /* end paren */
+ if (!HDstrcmp(")", temp)) { /* end paren */
get_next_dim = 0;
}
else { /* comma */
i++;
if (i >= MAX_NUM_DIMENSION) {
- (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ (void)HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
}
@@ -1774,7 +1790,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
} /* if(!HDstrcmp("(", key)) start paren */
else {
- (void) HDfprintf(stderr, err16c, infile);
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
scanret = fscanf(strm, "%254s", temp); /* end bracket */
@@ -1782,71 +1798,71 @@ static int processConfigurationFile(char *infile, struct Input *in)
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
} /* if(!HDstrcmp("/", key)) max dims separator */
- } /* else if(!HDstrcmp("SIMPLE", key)) */
+ } /* else if(!HDstrcmp("SIMPLE", key)) */
else {
- (void) HDfprintf(stderr, err5b, infile);
+ (void)HDfprintf(stderr, err5b, infile);
goto error;
}
} /* else if(!HDstrcmp("DATASPACE", key)) RANK and DIMENSIONS */
- else if(!HDstrcmp("STORAGE_LAYOUT", key)) { /* CHUNKED-DIMENSION-SIZES */
+ else if (!HDstrcmp("STORAGE_LAYOUT", key)) { /* CHUNKED-DIMENSION-SIZES */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT key\n");
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT %s found\n", temp);
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* CHUNKED */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT %s found\n", temp);
#endif
- if(!HDstrcmp("CHUNKED", temp)) { /* CHUNKED */
- if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
- (void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n");
+ if (!HDstrcmp("CHUNKED", temp)) { /* CHUNKED */
+ if ((in->sizeOfChunk = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) {
+ (void)HDfprintf(stderr, "Unable to allocate dynamic memory.\n");
goto error;
}
if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
#endif
- if(!HDstrcmp("(", temp)) { /* start paren */
+ if (!HDstrcmp("(", temp)) { /* start paren */
int get_next_dim = 1;
- int icount = 0;
+ int icount = 0;
if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
- (void) HDfprintf(stderr, err16c, infile);
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
#endif
while (get_next_dim) {
- char *more = temp;
+ char *more = temp;
in->sizeOfChunk[icount] = HDstrtoull(more, &more, 10);
if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
#endif
- if(!HDstrcmp(")", temp)) { /* end paren */
+ if (!HDstrcmp(")", temp)) { /* end paren */
in->configOptionVector[RANK] = 1;
- get_next_dim = 0;
+ get_next_dim = 0;
}
else { /* Dimension */
icount++;
if (icount > MAX_NUM_DIMENSION) {
- (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ (void)HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
}
@@ -1861,19 +1877,19 @@ static int processConfigurationFile(char *infile, struct Input *in)
in->configOptionVector[DIM] = 1;
} /* if(!HDstrcmp("(", key)) start paren */
else {
- (void) HDfprintf(stderr, err5b, infile);
+ (void)HDfprintf(stderr, err5b, infile);
goto error;
}
if (fscanf(strm, "%254s", temp) != 1) { /* SIZE */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp);
#endif
- if(!HDstrcmp("SIZE", temp)) { /* SIZE */
+ if (!HDstrcmp("SIZE", temp)) { /* SIZE */
if (fscanf(strm, "%d", (&ival)) != 1) {
- (void) HDfprintf(stderr, "%s", err19);
+ (void)HDfprintf(stderr, "%s", err19);
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1882,7 +1898,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
}
while (HDstrcmp("}", temp)) {
if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1891,52 +1907,52 @@ static int processConfigurationFile(char *infile, struct Input *in)
}
in->configOptionVector[CHUNK] = 1;
} /* if(!HDstrcmp("CHUNKED", key)) CHUNKED */
- } /* else if(!HDstrcmp("STORAGE_LAYOUT", key)) CHUNKED-DIMENSION-SIZES */
- else if(!HDstrcmp("FILTERS", key)) { /* FILTERS */
+ } /* else if(!HDstrcmp("STORAGE_LAYOUT", key)) CHUNKED-DIMENSION-SIZES */
+ else if (!HDstrcmp("FILTERS", key)) { /* FILTERS */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS key\n");
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS %s found\n", temp);
#endif
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS %s found\n", temp);
#endif
- if(!HDstrcmp("COMPRESSION", temp)) { /* COMPRESSION */
+ if (!HDstrcmp("COMPRESSION", temp)) { /* COMPRESSION */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION found\n");
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* DEFLATE */
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* bgin bracket */
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* LEVEL */
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
if (fscanf(strm, "%d", (&ival)) != 1) {
- (void) HDfprintf(stderr, "%s", err19);
+ (void)HDfprintf(stderr, "%s", err19);
goto error;
}
#ifdef H5DEBUGIMPORT
@@ -1944,95 +1960,95 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
in->compressionParam = ival;
if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
- in->compressionType = 0; /* ONLY GZIP supported */
+ in->compressionType = 0; /* ONLY GZIP supported */
in->configOptionVector[COMPRESS] = 1;
}
- else if(!HDstrcmp("CONTIGUOUS", temp)) { /* CONTIGUOUS */
+ else if (!HDstrcmp("CONTIGUOUS", temp)) { /* CONTIGUOUS */
#ifdef H5DEBUGIMPORT
- HDprintf("h5dump FILTERS CONTIGUOUS found\n");
+ HDprintf("h5dump FILTERS CONTIGUOUS found\n");
#endif
in->configOptionVector[COMPRESS] = 0;
}
- else if(!HDstrcmp("NONE", temp)) { /* NONE */
+ else if (!HDstrcmp("NONE", temp)) { /* NONE */
#ifdef H5DEBUGIMPORT
- HDprintf("h5dump FILTERS NONE found\n");
+ HDprintf("h5dump FILTERS NONE found\n");
#endif
in->configOptionVector[COMPRESS] = 0;
}
if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS %s found\n", temp);
#endif
}
- else if(!HDstrcmp("SUBSET", key)) { /* reduce dimensions */
- hsize_t temp_dims[MAX_NUM_DIMENSION];
- int get_next_prop = 1;
+ else if (!HDstrcmp("SUBSET", key)) { /* reduce dimensions */
+ hsize_t temp_dims[MAX_NUM_DIMENSION];
+ int get_next_prop = 1;
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET key\n");
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
- (void) HDfprintf(stderr, err20, infile);
+ (void)HDfprintf(stderr, err20, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET %s found\n", temp);
#endif
if (fscanf(strm, "%254s", temp) != 1) { /* SUBSET keyword */
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET %s found\n", temp);
#endif
while (get_next_prop) {
- if(!HDstrcmp("COUNT", temp)) { /* COUNT */
+ if (!HDstrcmp("COUNT", temp)) { /* COUNT */
int icount = 0;
if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET %s found\n", temp);
#endif
- if(!HDstrcmp("(", temp)) { /* start paren */
+ if (!HDstrcmp("(", temp)) { /* start paren */
int get_next_dim = 1;
- int i = 0;
+ int i = 0;
if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
- (void) HDfprintf(stderr, err16c, infile);
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET COUNT [%s] found\n", temp);
#endif
while (get_next_dim) {
- char *more = temp;
+ char *more = temp;
temp_dims[icount] = HDstrtoull(more, &more, 10);
if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET COUNT %s found\n", temp);
#endif
- if(!HDstrcmp(");", temp)) { /* end paren */
- in->rank = ++icount;
+ if (!HDstrcmp(");", temp)) { /* end paren */
+ in->rank = ++icount;
in->configOptionVector[RANK] = 1;
- get_next_dim = 0;
+ get_next_dim = 0;
}
else { /* Dimension */
icount++;
if (icount >= MAX_NUM_DIMENSION) {
- (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ (void)HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
}
@@ -2048,47 +2064,47 @@ static int processConfigurationFile(char *infile, struct Input *in)
HDprintf("\n");
#endif
in->configOptionVector[DIM] = 1;
- } /* if(!HDstrcmp("(", key)) start paren */
- } /* if(!HDstrcmp("COUNT", temp)) COUNT */
- if(!HDstrcmp("BLOCK", temp)) { /* BLOCK */
+ } /* if(!HDstrcmp("(", key)) start paren */
+ } /* if(!HDstrcmp("COUNT", temp)) COUNT */
+ if (!HDstrcmp("BLOCK", temp)) { /* BLOCK */
int icount = 0;
if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET %s found\n", temp);
#endif
- if(!HDstrcmp("(", temp)) { /* start paren */
+ if (!HDstrcmp("(", temp)) { /* start paren */
int get_next_dim = 1;
- int i = 0;
+ int i = 0;
if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
- (void) HDfprintf(stderr, err16c, infile);
+ (void)HDfprintf(stderr, err16c, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
- HDprintf("h5dump SUBSET BLOCK [%s] found\n", temp);
+ HDprintf("h5dump SUBSET BLOCK [%s] found\n", temp);
#endif
while (get_next_dim) {
- char *more = temp;
+ char *more = temp;
temp_dims[icount] = HDstrtoull(more, &more, 10);
if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
- (void) HDfprintf(stderr, err6b, infile);
+ (void)HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET BLOCK %s found\n", temp);
#endif
- if(!HDstrcmp(");", temp)) { /* end paren */
- in->rank = ++icount;
+ if (!HDstrcmp(");", temp)) { /* end paren */
+ in->rank = ++icount;
in->configOptionVector[RANK] = 1;
- get_next_dim = 0;
+ get_next_dim = 0;
}
else { /* Dimension */
icount++;
if (icount > MAX_NUM_DIMENSION) {
- (void) HDfprintf(stderr, "Invalid value for rank.\n");
+ (void)HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
}
@@ -2105,20 +2121,20 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
in->configOptionVector[DIM] = 1;
} /* if(!HDstrcmp("(", key)) start paren */
- } /* if(!HDstrcmp("BLOCK", temp)) BLOCK */
+ } /* if(!HDstrcmp("BLOCK", temp)) BLOCK */
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
+ (void)HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET %s found\n", temp);
#endif
- if(!HDstrcmp("}", temp)) { /* end bracket */
+ if (!HDstrcmp("}", temp)) { /* end bracket */
get_next_prop = 0;
}
- } /* while (get_next_prop) */
- } /* else if(!HDstrcmp("SUBSET", key)) */
- else if(!HDstrcmp("DATA", key)) { /* FINSHED */
+ } /* while (get_next_prop) */
+ } /* else if(!HDstrcmp("SUBSET", key)) */
+ else if (!HDstrcmp("DATA", key)) { /* FINSHED */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATA key\n");
#endif
@@ -2157,256 +2173,255 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
while (scanret == 1) {
if ((kindex = mapKeywordToIndex(key)) == -1) {
- (void) HDfprintf(stderr, err2, key, infile);
+ (void)HDfprintf(stderr, err2, key, infile);
goto error;
}
switch (kindex) {
- case 0: /* PATH */
- if (in->configOptionVector[PATH] == 1) {
- (void) HDfprintf(stderr, err3a, infile);
- goto error;
- }
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
- goto error;
- }
- if (parsePathInfo(&in->path, temp) == -1) {
- (void) HDfprintf(stderr, err3b, infile);
- goto error;
- }
- in->configOptionVector[PATH] = 1;
- break;
+ case 0: /* PATH */
+ if (in->configOptionVector[PATH] == 1) {
+ (void)HDfprintf(stderr, err3a, infile);
+ goto error;
+ }
+ if (fscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+ if (parsePathInfo(&in->path, temp) == -1) {
+ (void)HDfprintf(stderr, err3b, infile);
+ goto error;
+ }
+ in->configOptionVector[PATH] = 1;
+ break;
- case 1: /* INPUT-CLASS */
- if (in->configOptionVector[INPUT_CLASS] == 1) {
- (void) HDfprintf(stderr, err4a, infile);
- goto error;
- }
+ case 1: /* INPUT-CLASS */
+ if (in->configOptionVector[INPUT_CLASS] == 1) {
+ (void)HDfprintf(stderr, err4a, infile);
+ goto error;
+ }
- if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err18);
- goto error;
- }
- if (getInputClass(in, temp) == -1) {
- (void) HDfprintf(stderr, err4b, infile);
- goto error;
- }
+ if (fscanf(strm, "%254s", temp) != 1) {
+ (void)HDfprintf(stderr, "%s", err18);
+ goto error;
+ }
+ if (getInputClass(in, temp) == -1) {
+ (void)HDfprintf(stderr, err4b, infile);
+ goto error;
+ }
- in->configOptionVector[INPUT_CLASS] = 1;
+ in->configOptionVector[INPUT_CLASS] = 1;
- /*set default value for output-class */
- if (in->configOptionVector[OUTPUT_CLASS] == 0) {
- if (in->inputClass == 0 || in->inputClass == 4)
- in->outputClass = 0;
- if (in->inputClass == 1 || in->inputClass == 2
- || in->inputClass == 3)
- in->outputClass = 1;
- if (in->inputClass == 6 || in->inputClass == 7)
- in->outputClass = 2;
- }
- break;
+ /*set default value for output-class */
+ if (in->configOptionVector[OUTPUT_CLASS] == 0) {
+ if (in->inputClass == 0 || in->inputClass == 4)
+ in->outputClass = 0;
+ if (in->inputClass == 1 || in->inputClass == 2 || in->inputClass == 3)
+ in->outputClass = 1;
+ if (in->inputClass == 6 || in->inputClass == 7)
+ in->outputClass = 2;
+ }
+ break;
- case 2: /* INPUT-SIZE */
- if (in->configOptionVector[INPUT_SIZE] == 1) {
- (void) HDfprintf(stderr, err5a, infile);
- goto error;
- }
- if (fscanf(strm, "%254d", (&ival)) != 1) {
- (void) HDfprintf(stderr, "%s", err19);
- goto error;
- }
- if (getInputSize(in, ival) == -1) {
- (void) HDfprintf(stderr, err5b, infile);
- goto error;
- }
- in->configOptionVector[INPUT_SIZE] = 1;
+ case 2: /* INPUT-SIZE */
+ if (in->configOptionVector[INPUT_SIZE] == 1) {
+ (void)HDfprintf(stderr, err5a, infile);
+ goto error;
+ }
+ if (fscanf(strm, "%254d", (&ival)) != 1) {
+ (void)HDfprintf(stderr, "%s", err19);
+ goto error;
+ }
+ if (getInputSize(in, ival) == -1) {
+ (void)HDfprintf(stderr, err5b, infile);
+ goto error;
+ }
+ in->configOptionVector[INPUT_SIZE] = 1;
- /*set default value for output-size */
- if (in->configOptionVector[OUTPUT_SIZE] == 0)
- in->outputSize = in->inputSize;
- break;
+ /*set default value for output-size */
+ if (in->configOptionVector[OUTPUT_SIZE] == 0)
+ in->outputSize = in->inputSize;
+ break;
- case 3: /* RANK */
- if (in->configOptionVector[RANK] == 1) {
- (void) HDfprintf(stderr, err6a, infile);
- goto error;
- }
+ case 3: /* RANK */
+ if (in->configOptionVector[RANK] == 1) {
+ (void)HDfprintf(stderr, err6a, infile);
+ goto error;
+ }
- if (getRank(in, strm) == -1) {
- (void) HDfprintf(stderr, err6b, infile);
- goto error;
- }
- in->configOptionVector[RANK] = 1;
- break;
+ if (getRank(in, strm) == -1) {
+ (void)HDfprintf(stderr, err6b, infile);
+ goto error;
+ }
+ in->configOptionVector[RANK] = 1;
+ break;
- case 4: /* DIMENSION-SIZES */
- if (in->configOptionVector[DIM] == 1) {
- (void) HDfprintf(stderr, err7a, infile);
- goto error;
- }
+ case 4: /* DIMENSION-SIZES */
+ if (in->configOptionVector[DIM] == 1) {
+ (void)HDfprintf(stderr, err7a, infile);
+ goto error;
+ }
- if (in->configOptionVector[RANK] == 0) {
- (void) HDfprintf(stderr, err7b, infile);
- goto error;
- }
- if (getDimensionSizes(in, strm) == -1) {
- (void) HDfprintf(stderr, err7c, infile);
- goto error;
- }
- in->configOptionVector[DIM] = 1;
- break;
+ if (in->configOptionVector[RANK] == 0) {
+ (void)HDfprintf(stderr, err7b, infile);
+ goto error;
+ }
+ if (getDimensionSizes(in, strm) == -1) {
+ (void)HDfprintf(stderr, err7c, infile);
+ goto error;
+ }
+ in->configOptionVector[DIM] = 1;
+ break;
- case 5: /* OUTPUT-CLASS */
- if (in->configOptionVector[OUTPUT_CLASS] == 1) {
- (void) HDfprintf(stderr, err8a, infile);
- goto error;
- }
+ case 5: /* OUTPUT-CLASS */
+ if (in->configOptionVector[OUTPUT_CLASS] == 1) {
+ (void)HDfprintf(stderr, err8a, infile);
+ goto error;
+ }
- if (getOutputClass(in, strm) == -1) {
- (void) HDfprintf(stderr, err8b, infile);
- goto error;
- }
- in->configOptionVector[OUTPUT_CLASS] = 1;
- break;
+ if (getOutputClass(in, strm) == -1) {
+ (void)HDfprintf(stderr, err8b, infile);
+ goto error;
+ }
+ in->configOptionVector[OUTPUT_CLASS] = 1;
+ break;
- case 6: /* OUTPUT-SIZE */
- if (in->configOptionVector[OUTPUT_SIZE] == 1) {
- (void) HDfprintf(stderr, err9a, infile);
- goto error;
- }
+ case 6: /* OUTPUT-SIZE */
+ if (in->configOptionVector[OUTPUT_SIZE] == 1) {
+ (void)HDfprintf(stderr, err9a, infile);
+ goto error;
+ }
- if (getOutputSize(in, strm) == -1) {
- (void) HDfprintf(stderr, err9b, infile);
- goto error;
- }
- in->configOptionVector[OUTPUT_SIZE] = 1;
- break;
+ if (getOutputSize(in, strm) == -1) {
+ (void)HDfprintf(stderr, err9b, infile);
+ goto error;
+ }
+ in->configOptionVector[OUTPUT_SIZE] = 1;
+ break;
- case 7: /* OUTPUT-ARCHITECTURE */
- if (in->configOptionVector[OUTPUT_ARCH] == 1) {
- (void) HDfprintf(stderr, err10a, infile);
- goto error;
- }
+ case 7: /* OUTPUT-ARCHITECTURE */
+ if (in->configOptionVector[OUTPUT_ARCH] == 1) {
+ (void)HDfprintf(stderr, err10a, infile);
+ goto error;
+ }
- if (getOutputArchitecture(in, strm) == -1) {
- (void) HDfprintf(stderr, err10b, infile);
- goto error;
- }
- in->configOptionVector[OUTPUT_ARCH] = 1;
- break;
+ if (getOutputArchitecture(in, strm) == -1) {
+ (void)HDfprintf(stderr, err10b, infile);
+ goto error;
+ }
+ in->configOptionVector[OUTPUT_ARCH] = 1;
+ break;
- case 8: /* OUTPUT-BYTE-ORDER */
- if (in->configOptionVector[OUTPUT_B_ORDER] == 1) {
- (void) HDfprintf(stderr, err11a, infile);
- goto error;
- }
+ case 8: /* OUTPUT-BYTE-ORDER */
+ if (in->configOptionVector[OUTPUT_B_ORDER] == 1) {
+ (void)HDfprintf(stderr, err11a, infile);
+ goto error;
+ }
- if (getOutputByteOrder(in, strm) == -1) {
- (void) HDfprintf(stderr, err11b, infile);
- goto error;
- }
- in->configOptionVector[OUTPUT_B_ORDER] = 1;
- break;
+ if (getOutputByteOrder(in, strm) == -1) {
+ (void)HDfprintf(stderr, err11b, infile);
+ goto error;
+ }
+ in->configOptionVector[OUTPUT_B_ORDER] = 1;
+ break;
- case 9: /* CHUNKED-DIMENSION-SIZES */
- if (in->configOptionVector[CHUNK] == 1) {
- (void) HDfprintf(stderr, err12a, infile);
- goto error;
- }
- /* cant appear before dimension sizes have been provided */
- if (in->configOptionVector[DIM] == 0) {
- (void) HDfprintf(stderr, err12b, infile);
- goto error;
- }
+ case 9: /* CHUNKED-DIMENSION-SIZES */
+ if (in->configOptionVector[CHUNK] == 1) {
+ (void)HDfprintf(stderr, err12a, infile);
+ goto error;
+ }
+ /* cant appear before dimension sizes have been provided */
+ if (in->configOptionVector[DIM] == 0) {
+ (void)HDfprintf(stderr, err12b, infile);
+ goto error;
+ }
- if (getChunkedDimensionSizes(in, strm) == -1) {
- (void) HDfprintf(stderr, err12c, infile);
- goto error;
- }
- in->configOptionVector[CHUNK] = 1;
- break;
+ if (getChunkedDimensionSizes(in, strm) == -1) {
+ (void)HDfprintf(stderr, err12c, infile);
+ goto error;
+ }
+ in->configOptionVector[CHUNK] = 1;
+ break;
- case 10: /* COMPRESSION-TYPE */
- if (in->configOptionVector[COMPRESS] == 1) {
- (void) HDfprintf(stderr, err13a, infile);
- goto error;
- }
+ case 10: /* COMPRESSION-TYPE */
+ if (in->configOptionVector[COMPRESS] == 1) {
+ (void)HDfprintf(stderr, err13a, infile);
+ goto error;
+ }
- if (getCompressionType(in, strm) == -1) {
- (void) HDfprintf(stderr, err13b, infile);
- goto error;
- }
- in->configOptionVector[COMPRESS] = 1;
+ if (getCompressionType(in, strm) == -1) {
+ (void)HDfprintf(stderr, err13b, infile);
+ goto error;
+ }
+ in->configOptionVector[COMPRESS] = 1;
- if (in->configOptionVector[COMPRESS_PARAM] == 0) {
- if (in->compressionType == 0)
- in->compressionParam = 6; /* default value if compressionType is GZIP */
- }
- break;
+ if (in->configOptionVector[COMPRESS_PARAM] == 0) {
+ if (in->compressionType == 0)
+ in->compressionParam = 6; /* default value if compressionType is GZIP */
+ }
+ break;
- case 11: /* COMPRESSION-PARAM */
- if (in->configOptionVector[COMPRESS_PARAM] == 1) {
- (void) HDfprintf(stderr, err14a, infile);
- goto error;
- }
+ case 11: /* COMPRESSION-PARAM */
+ if (in->configOptionVector[COMPRESS_PARAM] == 1) {
+ (void)HDfprintf(stderr, err14a, infile);
+ goto error;
+ }
- if (getCompressionParameter(in, strm) == -1) {
- (void) HDfprintf(stderr, err14b, infile);
- goto error;
- }
+ if (getCompressionParameter(in, strm) == -1) {
+ (void)HDfprintf(stderr, err14b, infile);
+ goto error;
+ }
- in->configOptionVector[COMPRESS_PARAM] = 1;
+ in->configOptionVector[COMPRESS_PARAM] = 1;
- if (in->configOptionVector[COMPRESS] == 0)
- in->compressionType = 0;
+ if (in->configOptionVector[COMPRESS] == 0)
+ in->compressionType = 0;
- break;
+ break;
- case 12: /* EXTERNAL-STORAGE */
- if (in->configOptionVector[EXTERNALSTORE] == 1) {
- (void) HDfprintf(stderr, err15a, infile);
- goto error;
- }
+ case 12: /* EXTERNAL-STORAGE */
+ if (in->configOptionVector[EXTERNALSTORE] == 1) {
+ (void)HDfprintf(stderr, err15a, infile);
+ goto error;
+ }
- if (getExternalFilename(in, strm) == -1) {
- (void) HDfprintf(stderr, err15b, infile);
- goto error;
- }
- in->configOptionVector[EXTERNALSTORE] = 1;
- break;
+ if (getExternalFilename(in, strm) == -1) {
+ (void)HDfprintf(stderr, err15b, infile);
+ goto error;
+ }
+ in->configOptionVector[EXTERNALSTORE] = 1;
+ break;
- case 13: /* MAXIMUM-DIMENSIONS */
- if (in->configOptionVector[EXTEND] == 1) {
- (void) HDfprintf(stderr, err16a, infile);
- goto error;
- }
- /* cant appear before dimension sizes have been provided */
- if (in->configOptionVector[DIM] == 0) {
- (void) HDfprintf(stderr, err16b, infile);
- goto error;
- }
- if (getMaximumDimensionSizes(in, strm) == -1) {
- (void) HDfprintf(stderr, err16c, infile);
- goto error;
- }
- in->configOptionVector[EXTEND] = 1;
- break;
+ case 13: /* MAXIMUM-DIMENSIONS */
+ if (in->configOptionVector[EXTEND] == 1) {
+ (void)HDfprintf(stderr, err16a, infile);
+ goto error;
+ }
+ /* cant appear before dimension sizes have been provided */
+ if (in->configOptionVector[DIM] == 0) {
+ (void)HDfprintf(stderr, err16b, infile);
+ goto error;
+ }
+ if (getMaximumDimensionSizes(in, strm) == -1) {
+ (void)HDfprintf(stderr, err16c, infile);
+ goto error;
+ }
+ in->configOptionVector[EXTEND] = 1;
+ break;
- case 14: /* INPUT-BYTE-ORDER */
- if (in->configOptionVector[INPUT_B_ORDER] == 1) {
- (void) HDfprintf(stderr, err11c, infile);
- goto error;
- }
+ case 14: /* INPUT-BYTE-ORDER */
+ if (in->configOptionVector[INPUT_B_ORDER] == 1) {
+ (void)HDfprintf(stderr, err11c, infile);
+ goto error;
+ }
- if (getInputByteOrder(in, strm) == -1) {
- (void) HDfprintf(stderr, err11d, infile);
- goto error;
- }
- in->configOptionVector[INPUT_B_ORDER] = 1;
- break;
+ if (getInputByteOrder(in, strm) == -1) {
+ (void)HDfprintf(stderr, err11d, infile);
+ goto error;
+ }
+ in->configOptionVector[INPUT_B_ORDER] = 1;
+ break;
- default:
- break;
+ default:
+ break;
}
scanret = fscanf(strm, "%254s", key);
}
@@ -2417,7 +2432,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
*/
if (validateConfigurationParameters(in) == -1) {
- (void) HDfprintf(stderr, err17, infile);
+ (void)HDfprintf(stderr, err17, infile);
goto error;
}
}
@@ -2426,19 +2441,22 @@ static int processConfigurationFile(char *infile, struct Input *in)
retval = 0;
error:
- if(strm)
+ if (strm)
HDfclose(strm);
- return(retval);
+ return (retval);
}
-static int validateConfigurationParameters(struct Input *in)
+static int
+validateConfigurationParameters(struct Input *in)
{
const char *err1 = "One or more of the required fields (RANK, DIMENSION-SIZES) missing.\n";
- const char *err2 = "Cannot specify chunking or compression or extendible data sets with the external file option.\n";
- const char *err3 = "Cannot specify the compression or the extendible data sets without the chunking option.\n";
+ const char *err2 =
+ "Cannot specify chunking or compression or extendible data sets with the external file option.\n";
+ const char *err3 =
+ "Cannot specify the compression or the extendible data sets without the chunking option.\n";
const char *err4a = "OUTPUT-ARCHITECTURE cannot be STD if OUTPUT-CLASS is floating point (FP).\n";
const char *err4b = "OUTPUT-ARCHITECTURE cannot be IEEE if OUTPUT-CLASS is integer (IN).\n";
- const char *err5 = "For OUTPUT-CLASS FP, valid values for OUTPUT-SIZE are (32, 64) .\n";
+ const char *err5 = "For OUTPUT-CLASS FP, valid values for OUTPUT-SIZE are (32, 64) .\n";
#ifndef H5_SIZEOF_LONG_LONG
const char *err6 = "No support for reading 64-bit integer (INPUT-CLASS: IN, TEXTIN, UIN, TEXTUIN files\n";
#endif
@@ -2448,20 +2466,21 @@ static int validateConfigurationParameters(struct Input *in)
return (0);
if ((in->configOptionVector[DIM] != 1) || (in->configOptionVector[RANK] != 1)) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if (in->configOptionVector[EXTERNALSTORE] == 1) {
- if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[CHUNK] == 1) || (in->configOptionVector[EXTEND] == 1)) {
- (void) HDfprintf(stderr, "%s", err2);
+ if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[CHUNK] == 1) ||
+ (in->configOptionVector[EXTEND] == 1)) {
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
}
if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[EXTEND] == 1)) {
if (in->configOptionVector[CHUNK] != 1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
}
@@ -2469,33 +2488,35 @@ static int validateConfigurationParameters(struct Input *in)
/* Arch cant be STD if O/p class is FP */
if (in->outputArchitecture == 1)
if (in->outputClass == 1) {
- (void) HDfprintf(stderr, "%s", err4a);
+ (void)HDfprintf(stderr, "%s", err4a);
return (-1);
}
/* Arch cant be IEEE if O/p class is IN */
if (in->outputArchitecture == 2)
if (in->outputClass == 0) {
- (void) HDfprintf(stderr, "%s", err4b);
+ (void)HDfprintf(stderr, "%s", err4b);
return (-1);
}
if (in->outputClass == 1)
if (in->outputSize != 32 && in->outputSize != 64) {
- (void) HDfprintf(stderr, "%s", err5);
+ (void)HDfprintf(stderr, "%s", err5);
return (-1);
}
#ifndef H5_SIZEOF_LONG_LONG
- if (in->inputSize == 64 && (in->inputClass == 0 || in->inputClass == 4 || in->inputClass == 6 || in->inputClass == 7) ) {
- (void) HDfprintf(stderr, "%s", err6);
+ if (in->inputSize == 64 &&
+ (in->inputClass == 0 || in->inputClass == 4 || in->inputClass == 6 || in->inputClass == 7)) {
+ (void)HDfprintf(stderr, "%s", err6);
return -1;
}
#endif
return (0);
}
-static int mapKeywordToIndex(char *key)
+static int
+mapKeywordToIndex(char *key)
{
int i;
@@ -2505,66 +2526,67 @@ static int mapKeywordToIndex(char *key)
return -1;
}
-static int parsePathInfo(struct path_info *path, char *temp)
+static int
+parsePathInfo(struct path_info *path, char *temp)
{
const char delimiter[] = "/\"";
- char *token;
- int i = 0;
+ char * token;
+ int i = 0;
const char *err1 = "Path string larger than MAX_PATH_NAME_LENGTH.\n";
- token = HDstrtok (temp, delimiter);
+ token = HDstrtok(temp, delimiter);
if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) {
- (void) HDfprintf(stderr, err1);
+ (void)HDfprintf(stderr, err1);
return (-1);
}
- HDstrcpy(path->group[i++],token);
+ HDstrcpy(path->group[i++], token);
while (1) {
- token = HDstrtok (NULL, delimiter);
+ token = HDstrtok(NULL, delimiter);
if (token == NULL)
break;
if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) {
- (void) HDfprintf(stderr, err1);
+ (void)HDfprintf(stderr, err1);
return (-1);
}
- HDstrcpy(path->group[i++],token);
+ HDstrcpy(path->group[i++], token);
}
path->count = i;
return (0);
}
-static int parseDimensions(struct Input *in, char *strm)
+static int
+parseDimensions(struct Input *in, char *strm)
{
const char delimiter[] = ",";
char temp[255];
- char *token;
- int i = 0;
+ char * token;
+ int i = 0;
const char *err1 = "Unable to allocate dynamic memory.\n";
HDstrncpy(temp, strm, sizeof(temp));
temp[sizeof(temp) - 1] = '\0';
- HDstrtok (temp, delimiter);
+ HDstrtok(temp, delimiter);
while (1) {
- token = HDstrtok (NULL, delimiter);
+ token = HDstrtok(NULL, delimiter);
if (token == NULL)
break;
i++;
}
in->rank = i + 1;
- if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
+ if ((in->sizeOfDimension = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
i = 0;
HDstrncpy(temp, strm, sizeof(temp));
- temp[sizeof(temp) - 1] = '\0';
- in->sizeOfDimension[i++]
- = HDstrtoull(HDstrtok (temp, delimiter), NULL, BASE_10);
+ temp[sizeof(temp) - 1] = '\0';
+ in->sizeOfDimension[i++] = HDstrtoull(HDstrtok(temp, delimiter), NULL, BASE_10);
while (1) {
- token = HDstrtok (NULL, delimiter);
+ token = HDstrtok(NULL, delimiter);
if (token == NULL)
break;
in->sizeOfDimension[i++] = HDstrtoull(token, NULL, BASE_10);
@@ -2572,7 +2594,8 @@ static int parseDimensions(struct Input *in, char *strm)
return (0);
}
-static int getOutputClass(struct Input *in, FILE *strm)
+static int
+getOutputClass(struct Input *in, FILE *strm)
{
char temp[255];
int kindex;
@@ -2580,12 +2603,12 @@ static int getOutputClass(struct Input *in, FILE *strm)
const char *err2 = "Invalid value for output class.\n";
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = OutputClassStrToInt(temp)) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
@@ -2593,10 +2616,11 @@ static int getOutputClass(struct Input *in, FILE *strm)
return (0);
}
-static int OutputClassStrToInt(char *temp)
+static int
+OutputClassStrToInt(char *temp)
{
- int i;
- char classKeywordTable[3][15] = { "IN", "FP", "UIN" };
+ int i;
+ char classKeywordTable[3][15] = {"IN", "FP", "UIN"};
for (i = 0; i < 3; i++)
if (!HDstrcmp(classKeywordTable[i], temp))
return i;
@@ -2604,16 +2628,17 @@ static int OutputClassStrToInt(char *temp)
return -1;
}
/* same as getInputSize. But defined separately for extensibility */
-static int getOutputSize(struct Input *in, FILE *strm)
+static int
+getOutputSize(struct Input *in, FILE *strm)
{
int ival;
int i;
- int outputSizeValidValues[4] = { 8, 16, 32, 64 };
- const char *err1 = "Unable to get integer value.\n";
- const char *err2 = "Invalid value for output size.\n";
+ int outputSizeValidValues[4] = {8, 16, 32, 64};
+ const char *err1 = "Unable to get integer value.\n";
+ const char *err2 = "Invalid value for output size.\n";
if (fscanf(strm, "%d", (&ival)) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -2622,17 +2647,18 @@ static int getOutputSize(struct Input *in, FILE *strm)
in->outputSize = ival;
return (0);
}
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
-static int getInputClass(struct Input *in, char * temp)
+static int
+getInputClass(struct Input *in, char *temp)
{
int kindex;
const char *err1 = "Invalid value for input class.\n";
if ((kindex = InputClassStrToInt(temp)) == -1) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -2640,355 +2666,356 @@ static int getInputClass(struct Input *in, char * temp)
return (0);
}
-static int getInputClassType(struct Input *in, char * buffer)
+static int
+getInputClassType(struct Input *in, char *buffer)
{
int kindex = -1;
- const char *err1 = "Invalid value for input class.\n";
- const char *err2 = "Invalid value for output architecture.\n";
- const char *err3 = "Invalid value for input byte-order.\n";
+ const char *err1 = "Invalid value for input class.\n";
+ const char *err2 = "Invalid value for output architecture.\n";
+ const char *err3 = "Invalid value for input byte-order.\n";
if (!HDstrcmp(buffer, "H5T_STD_I8BE")) {
- in->inputSize = 8;
+ in->inputSize = 8;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I8LE")) {
- in->inputSize = 8;
+ in->inputSize = 8;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I16BE")) {
- in->inputSize = 16;
+ in->inputSize = 16;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I16LE")) {
- in->inputSize = 16;
+ in->inputSize = 16;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I32BE")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I32LE")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I64BE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_I64LE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_STD_U8BE")) {
- in->inputSize = 8;
+ in->inputSize = 8;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U8LE")) {
- in->inputSize = 8;
+ in->inputSize = 8;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U16BE")) {
- in->inputSize = 16;
+ in->inputSize = 16;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U16LE")) {
- in->inputSize = 16;
+ in->inputSize = 16;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U32BE")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U32LE")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U64BE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_STD_U64LE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_SCHAR")) {
- in->inputSize = 8;
+ in->inputSize = 8;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -2996,11 +3023,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_UCHAR")) {
- in->inputSize = 8;
+ in->inputSize = 8;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3008,11 +3035,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_SHORT")) {
- in->inputSize = 16;
+ in->inputSize = 16;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3020,11 +3047,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_USHORT")) {
- in->inputSize = 16;
+ in->inputSize = 16;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3032,11 +3059,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_INT")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3044,11 +3071,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_UINT")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3056,11 +3083,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_LONG")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3068,11 +3095,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_ULONG")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3080,11 +3107,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_LLONG")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3092,11 +3119,11 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 4;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_ULLONG")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3104,107 +3131,107 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 7;
}
else if (!HDstrcmp(buffer, "H5T_IEEE_F32BE")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_IEEE_F32LE")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_IEEE_F64BE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_IEEE_F64LE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("IEEE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_VAX_F32")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_VAX_F64")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_FLOAT")) {
- in->inputSize = 32;
+ in->inputSize = 32;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3212,24 +3239,24 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 3;
}
else if (!HDstrcmp(buffer, "H5T_NATIVE_DOUBLE")) {
- in->inputSize = 64;
+ in->inputSize = 64;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
kindex = 3;
}
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
else if (!HDstrcmp(buffer, "H5T_NATIVE_LDOUBLE")) {
- in->inputSize = H5_SIZEOF_LONG_DOUBLE;
+ in->inputSize = H5_SIZEOF_LONG_DOUBLE;
in->configOptionVector[INPUT_SIZE] = 1;
if ((kindex = OutputArchStrToInt("NATIVE")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
@@ -3237,192 +3264,192 @@ static int getInputClassType(struct Input *in, char * buffer)
kindex = 3;
}
#endif
- else if(!HDstrcmp(buffer, "H5T_TIME: not yet implemented")) {
+ else if (!HDstrcmp(buffer, "H5T_TIME: not yet implemented")) {
kindex = -1;
}
- else if(!HDstrcmp(buffer, "H5T_STRING")) {
+ else if (!HDstrcmp(buffer, "H5T_STRING")) {
kindex = 5;
}
/* case H5T_BITFIELD: */
else if (!HDstrcmp(buffer, "H5T_STD_B8BE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B8LE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B16BE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B16LE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B32BE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B32LE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B64BE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("BE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
else if (!HDstrcmp(buffer, "H5T_STD_B64LE")) {
if ((kindex = OutputArchStrToInt("STD")) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->outputArchitecture = kindex;
if ((kindex = OutputByteOrderStrToInt("LE")) == -1) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
in->outputByteOrder = kindex;
- #ifdef H5DEBUGIMPORT
+#ifdef H5DEBUGIMPORT
HDprintf("h5dump inputByteOrder %d\n", in->inputByteOrder);
- #endif
+#endif
kindex = -1;
}
/* case H5T_OPAQUE: */
- else if(!HDstrcmp(buffer, "H5T_OPAQUE")) {
+ else if (!HDstrcmp(buffer, "H5T_OPAQUE")) {
kindex = -1;
}
/* case H5T_COMPOUND: */
- else if(!HDstrcmp(buffer, "H5T_COMPOUND")) {
+ else if (!HDstrcmp(buffer, "H5T_COMPOUND")) {
kindex = -1;
}
/* case H5T_REFERENCE: */
- else if(!HDstrcmp(buffer, "H5T_REFERENCE")) {
+ else if (!HDstrcmp(buffer, "H5T_REFERENCE")) {
kindex = -1;
}
/* case H5T_ENUM: */
- else if(!HDstrcmp(buffer, "H5T_ENUM")) {
+ else if (!HDstrcmp(buffer, "H5T_ENUM")) {
kindex = -1;
}
/* case H5T_VLEN: */
- else if(!HDstrcmp(buffer, "H5T_VLEN")) {
+ else if (!HDstrcmp(buffer, "H5T_VLEN")) {
kindex = -1;
}
/* case H5T_ARRAY: */
- else if(!HDstrcmp(buffer, "H5T_ARRAY")) {
+ else if (!HDstrcmp(buffer, "H5T_ARRAY")) {
kindex = -1;
}
if (kindex == -1) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -3439,10 +3466,11 @@ static int getInputClassType(struct Input *in, char * buffer)
return (0);
}
-static int InputClassStrToInt(char *temp)
+static int
+InputClassStrToInt(char *temp)
{
- int i;
- char classKeywordTable[8][15] = { "TEXTIN", "TEXTFP", "TEXTFPE", "FP", "IN", "STR", "TEXTUIN", "UIN" };
+ int i;
+ char classKeywordTable[8][15] = {"TEXTIN", "TEXTFP", "TEXTFPE", "FP", "IN", "STR", "TEXTUIN", "UIN"};
for (i = 0; i < 8; i++)
if (!HDstrcmp(classKeywordTable[i], temp))
return i;
@@ -3450,22 +3478,24 @@ static int InputClassStrToInt(char *temp)
}
/* same as getOutputSize. But defined separately for extensibility */
-static int getInputSize(struct Input *in, int ival)
+static int
+getInputSize(struct Input *in, int ival)
{
int i;
- int inputSizeValidValues[4] = { 8, 16, 32, 64 };
- const char *err1 = "Invalid value for input size.\n";
+ int inputSizeValidValues[4] = {8, 16, 32, 64};
+ const char *err1 = "Invalid value for input size.\n";
for (i = 0; i < 4; i++)
if (inputSizeValidValues[i] == ival) {
in->inputSize = ival;
return (0);
}
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
-static int getInputByteOrder(struct Input *in, FILE *strm)
+static int
+getInputByteOrder(struct Input *in, FILE *strm)
{
char temp[255];
int kindex;
@@ -3473,12 +3503,12 @@ static int getInputByteOrder(struct Input *in, FILE *strm)
const char *err2 = "Invalid value for input byte-order.\n";
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = OutputByteOrderStrToInt(temp)) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
@@ -3486,15 +3516,16 @@ static int getInputByteOrder(struct Input *in, FILE *strm)
return (0);
}
-static int getRank(struct Input *in, FILE *strm)
+static int
+getRank(struct Input *in, FILE *strm)
{
- int ival;
+ int ival;
const char *err1 = "Unable to get integer value.\n";
const char *err2 = "Invalid value for rank.\n";
if (fscanf(strm, "%d", (&ival)) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if (ival >= MIN_NUM_DIMENSION && ival <= MAX_NUM_DIMENSION) {
@@ -3502,21 +3533,23 @@ static int getRank(struct Input *in, FILE *strm)
return (0);
}
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
/* same as getChunkedDimensionSizes. But defined separately for extensibility */
-static int getDimensionSizes(struct Input *in, FILE *strm)
+static int
+getDimensionSizes(struct Input *in, FILE *strm)
{
unsigned long long ullval;
- int i = 0;
+ int i = 0;
const char *err1 = "Unable to allocate dynamic memory.\n";
- const char *err2 = "No. of dimensions for which dimension sizes provided is not equal to provided rank.\n";
+ const char *err2 =
+ "No. of dimensions for which dimension sizes provided is not equal to provided rank.\n";
- if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
+ if ((in->sizeOfDimension = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -3524,23 +3557,25 @@ static int getDimensionSizes(struct Input *in, FILE *strm)
in->sizeOfDimension[i++] = ullval;
if (in->rank != i) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
return (0);
}
/* same as getDimensionSizes. But defined separately for extensibility */
-static int getChunkedDimensionSizes(struct Input *in, FILE *strm)
+static int
+getChunkedDimensionSizes(struct Input *in, FILE *strm)
{
unsigned long long ullval;
- int i = 0;
+ int i = 0;
const char *err1 = "Unable to allocate dynamic memory.\n";
- const char *err2 = "No. of dimensions for which chunked dimension sizes provided is not equal to provided rank.\n";
+ const char *err2 =
+ "No. of dimensions for which chunked dimension sizes provided is not equal to provided rank.\n";
const char *err3 = "The CHUNKED-DIMENSION-SIZES cannot exceed the sizes of DIMENSION-SIZES\n";
- if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
+ if ((in->sizeOfChunk = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -3548,29 +3583,32 @@ static int getChunkedDimensionSizes(struct Input *in, FILE *strm)
in->sizeOfChunk[i++] = ullval;
if (in->rank != i) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
for (i = 0; i < in->rank; i++)
if (in->sizeOfChunk[i] > in->sizeOfDimension[i]) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
return (0);
}
-static int getMaximumDimensionSizes(struct Input *in, FILE *strm)
+static int
+getMaximumDimensionSizes(struct Input *in, FILE *strm)
{
long long llval;
- int i = 0;
+ int i = 0;
const char *err1 = "Unable to allocate dynamic memory.\n";
- const char *err2 = "No. of dimensions for which maximum dimension sizes provided is not equal to provided rank.\n";
- const char *err3 = "The MAXIMUM-DIMENSIONS cannot be less than the sizes of DIMENSION-SIZES. Exception: can be -1 to indicate unlimited size\n";
+ const char *err2 =
+ "No. of dimensions for which maximum dimension sizes provided is not equal to provided rank.\n";
+ const char *err3 = "The MAXIMUM-DIMENSIONS cannot be less than the sizes of DIMENSION-SIZES. Exception: "
+ "can be -1 to indicate unlimited size\n";
- if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
- (void) HDfprintf(stderr, "%s", err1);
+ if ((in->maxsizeOfDimension = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) {
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -3582,21 +3620,22 @@ static int getMaximumDimensionSizes(struct Input *in, FILE *strm)
}
if (in->rank != i) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
for (i = 0; i < in->rank; i++) {
if (in->maxsizeOfDimension[i] != H5S_UNLIMITED)
if (in->maxsizeOfDimension[i] < in->sizeOfDimension[i]) {
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err3);
return (-1);
}
}
return (0);
}
-static int getOutputArchitecture(struct Input *in, FILE *strm)
+static int
+getOutputArchitecture(struct Input *in, FILE *strm)
{
char temp[255];
int kindex;
@@ -3604,12 +3643,12 @@ static int getOutputArchitecture(struct Input *in, FILE *strm)
const char *err2 = "Invalid value for output architecture.\n";
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = OutputArchStrToInt(temp)) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
@@ -3617,18 +3656,19 @@ static int getOutputArchitecture(struct Input *in, FILE *strm)
return (0);
}
-static int OutputArchStrToInt(const char *temp)
+static int
+OutputArchStrToInt(const char *temp)
{
- int i;
- char outputArchKeywordTable[8][15] = { "NATIVE", "STD", "IEEE", "INTEL",
- "CRAY", "MIPS", "ALPHA", "UNIX" };
+ int i;
+ char outputArchKeywordTable[8][15] = {"NATIVE", "STD", "IEEE", "INTEL", "CRAY", "MIPS", "ALPHA", "UNIX"};
for (i = 0; i < 8; i++)
if (!HDstrcmp(outputArchKeywordTable[i], temp))
return i;
return -1;
}
-static int getOutputByteOrder(struct Input *in, FILE *strm)
+static int
+getOutputByteOrder(struct Input *in, FILE *strm)
{
char temp[255];
int kindex;
@@ -3636,12 +3676,12 @@ static int getOutputByteOrder(struct Input *in, FILE *strm)
const char *err2 = "Invalid value for output byte-order.\n";
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = OutputByteOrderStrToInt(temp)) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
@@ -3649,17 +3689,19 @@ static int getOutputByteOrder(struct Input *in, FILE *strm)
return (0);
}
-static int OutputByteOrderStrToInt(const char *temp)
+static int
+OutputByteOrderStrToInt(const char *temp)
{
- int i;
- char outputByteOrderKeywordTable[2][15] = { "BE", "LE" };
+ int i;
+ char outputByteOrderKeywordTable[2][15] = {"BE", "LE"};
for (i = 0; i < 2; i++)
if (!HDstrcmp(outputByteOrderKeywordTable[i], temp))
return i;
return -1;
}
-static int getCompressionType(struct Input *in, FILE *strm)
+static int
+getCompressionType(struct Input *in, FILE *strm)
{
char temp[255];
int kindex;
@@ -3667,34 +3709,35 @@ static int getCompressionType(struct Input *in, FILE *strm)
const char *err2 = "Invalid value for compression.\n";
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
if ((kindex = CompressionTypeStrToInt(temp)) == -1) {
- (void) HDfprintf(stderr, "%s", err2);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
}
in->compressionType = kindex;
return (0);
-
}
-static int CompressionTypeStrToInt(char *temp)
+static int
+CompressionTypeStrToInt(char *temp)
{
/* currently supports only GZIP */
/* can be extended by adding fields to the table */
- int i;
- char CompressionTypeKeywordTable[1][15] = { "GZIP" };
+ int i;
+ char CompressionTypeKeywordTable[1][15] = {"GZIP"};
for (i = 0; i < 1; i++)
if (!HDstrcmp(CompressionTypeKeywordTable[i], temp))
return i;
return -1;
}
-static int getCompressionParameter(struct Input *in, FILE *strm)
+static int
+getCompressionParameter(struct Input *in, FILE *strm)
{
/* currently supports only GZIP */
/* can be extended by adding more values to COMPRESSION-TYPE and */
@@ -3706,883 +3749,889 @@ static int getCompressionParameter(struct Input *in, FILE *strm)
const char *err3 = "Unsupported Compression Type.\n";
switch (in->compressionType) {
- case 0: /* GZIP */
- if (fscanf(strm, "%d", (&ival)) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
+ case 0: /* GZIP */
+ if (fscanf(strm, "%d", (&ival)) != 1) {
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ }
- if (ival < 0 || ival > 9) {
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- in->compressionParam = ival;
- return (0);
+ if (ival < 0 || ival > 9) {
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ in->compressionParam = ival;
+ return (0);
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
}
}
-static int getExternalFilename(struct Input *in, FILE *strm)
+static int
+getExternalFilename(struct Input *in, FILE *strm)
{
char temp[255];
const char *err1 = "Unable to get 'string' value.\n";
if (fscanf(strm, "%254s", temp) != 1) {
- (void) HDfprintf(stderr, "%s", err1);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
}
- in->externFilename = (char *) HDmalloc ((size_t) (HDstrlen(temp) + 1) * sizeof(char));
- (void) HDstrncpy(in->externFilename, temp, HDstrlen(temp) + 1);
+ in->externFilename = (char *)HDmalloc((size_t)(HDstrlen(temp) + 1) * sizeof(char));
+ (void)HDstrncpy(in->externFilename, temp, HDstrlen(temp) + 1);
return (0);
}
-void setDefaultValues(struct Input *in, int count)
+void
+setDefaultValues(struct Input *in, int count)
{
- int i;
- char temp[255];
- char num[255];
-
- in->h5dumpInput = 0;
- in->inputClass = 3; /* FP */
- in->inputSize = 32;
- in->outputClass = 1; /* FP */
- in->outputSize = 32;
+ int i;
+ char temp[255];
+ char num[255];
+
+ in->h5dumpInput = 0;
+ in->inputClass = 3; /* FP */
+ in->inputSize = 32;
+ in->outputClass = 1; /* FP */
+ in->outputSize = 32;
in->inputByteOrder = -1; /* use default */
- in->rank = 0;
- in->path.count = 1;
+ in->rank = 0;
+ in->path.count = 1;
HDstrcpy(temp, "dataset");
HDsprintf(num, "%d", count);
HDstrcat(temp, num);
HDstrcpy(in->path.group[0], temp);
- in->outputArchitecture = 0; /* NATIVE */
- in->outputByteOrder = -1; /* use default */
- in->compressionType = 0; /* GZIP */
+ in->outputArchitecture = 0; /* NATIVE */
+ in->outputByteOrder = -1; /* use default */
+ in->compressionType = 0; /* GZIP */
for (i = 0; i < NUM_KEYS; i++)
in->configOptionVector[i] = 0;
}
-hid_t createOutputDataType(struct Input *in)
+hid_t
+createOutputDataType(struct Input *in)
{
hid_t new_type = (-1);
- const char *err1 = "Invalid value for output class.\n";
- const char *err2 = "Invalid value for output size.\n";
- const char *err3 = "Invalid value for output byte order.\n";
- const char *err4 = "Invalid value for output architecture.\n";
- const char *err5 = "STD not supported for float.\n";
- const char *err6 = "IEEE not supported for INT.\n";
+ const char *err1 = "Invalid value for output class.\n";
+ const char *err2 = "Invalid value for output size.\n";
+ const char *err3 = "Invalid value for output byte order.\n";
+ const char *err4 = "Invalid value for output architecture.\n";
+ const char *err5 = "STD not supported for float.\n";
+ const char *err6 = "IEEE not supported for INT.\n";
switch (in->outputClass) {
- case 0:
- switch (in->outputArchitecture) {
- case 0: /* NATIVE */
- switch (in->outputSize) {
- case 8:
- new_type = H5Tcopy(H5T_NATIVE_CHAR);
- break;
-
- case 16:
- new_type = H5Tcopy(H5T_NATIVE_SHORT);
- break;
+ case 0:
+ switch (in->outputArchitecture) {
+ case 0: /* NATIVE */
+ switch (in->outputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_CHAR);
+ break;
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_INT);
- break;
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_SHORT);
+ break;
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_LLONG);
- break;
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_INT);
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- switch (in->outputByteOrder) {
- case -1: /* default */
- break;
- case 0:
- H5Tset_order(new_type, H5T_ORDER_BE);
- break;
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_LLONG);
+ break;
- case 1:
- H5Tset_order(new_type, H5T_ORDER_LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->outputByteOrder) {
+ case -1: /* default */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
- case 1: /* STD */
- switch (in->outputSize) {
- case 8:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_I8BE);
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
break;
- case 1:
- new_type = H5Tcopy(H5T_STD_I8LE);
- break;
+ case 1: /* STD */
+ switch (in->outputSize) {
+ case 8:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I8BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I8LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 16:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I16BE);
+ break;
- case 16:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_I16BE);
- break;
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I16LE);
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_I16LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 32:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I32BE);
+ break;
- case 32:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_I32BE);
- break;
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I32LE);
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_I32LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 64:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I64BE);
+ break;
- case 64:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_I64BE);
- break;
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I64LE);
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_I64LE);
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
break;
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err4);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
}
break;
- default:
- (void) HDfprintf(stderr, "%s", err4);
- return (-1);
- }
- break;
-
- case 1:
- switch (in->outputArchitecture) {
- case 0:
- switch (in->outputSize) {
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_FLOAT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- switch (in->outputByteOrder) {
- case -1: /* DEFAULT */
- break;
- case 0:
- H5Tset_order(new_type, H5T_ORDER_BE);
- break;
+ case 1:
+ switch (in->outputArchitecture) {
+ case 0:
+ switch (in->outputSize) {
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_FLOAT);
+ break;
- case 1:
- H5Tset_order(new_type, H5T_ORDER_LE);
- break;
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->outputByteOrder) {
+ case -1: /* DEFAULT */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
- case 1:
- (void) HDfprintf(stderr, "%s", err5);
- return (-1);
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
- case 2:
- switch (in->outputSize) {
- case 32:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_IEEE_F32BE);
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
break;
case 1:
- new_type = H5Tcopy(H5T_IEEE_F32LE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err5);
return (-1);
- }
- break;
- case 64:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_IEEE_F64BE);
- break;
+ case 2:
+ switch (in->outputSize) {
+ case 32:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_IEEE_F32BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_IEEE_F32LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- case 1:
- new_type = H5Tcopy(H5T_IEEE_F64LE);
+ case 64:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_IEEE_F64BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_IEEE_F64LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
break;
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err4);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
}
break;
- default:
- (void) HDfprintf(stderr, "%s", err4);
- return (-1);
- }
- break;
-
- case 2:
- switch (in->outputArchitecture) {
- case 0:
- switch (in->outputSize) {
- case 8:
- new_type = H5Tcopy(H5T_NATIVE_UCHAR);
- break;
-
- case 16:
- new_type = H5Tcopy(H5T_NATIVE_USHORT);
- break;
+ case 2:
+ switch (in->outputArchitecture) {
+ case 0:
+ switch (in->outputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_UCHAR);
+ break;
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_UINT);
- break;
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_USHORT);
+ break;
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_ULLONG);
- break;
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_UINT);
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- switch (in->outputByteOrder) {
- case -1: /* Default */
- break;
- case 0:
- H5Tset_order(new_type, H5T_ORDER_BE);
- break;
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_ULLONG);
+ break;
- case 1:
- H5Tset_order(new_type, H5T_ORDER_LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->outputByteOrder) {
+ case -1: /* Default */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
- case 1:
- switch (in->outputSize) {
- case 8:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U8BE);
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
break;
case 1:
- new_type = H5Tcopy(H5T_STD_U8LE);
- break;
+ switch (in->outputSize) {
+ case 8:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U8BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U8LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 16:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U16BE);
+ break;
- case 16:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U16BE);
- break;
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U16LE);
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_U16LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 32:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U32BE);
+ break;
- case 32:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U32BE);
- break;
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U32LE);
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_U32LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 64:
+ switch (in->outputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U64BE);
+ break;
- case 64:
- switch (in->outputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U64BE);
- break;
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U64LE);
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_U64LE);
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
+ case 2:
+ (void)HDfprintf(stderr, "%s", err6);
return (-1);
- }
- break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
+ default:
+ (void)HDfprintf(stderr, "%s", err4);
+ return (-1);
}
break;
- case 2:
- (void) HDfprintf(stderr, "%s", err6);
- return (-1);
-
default:
- (void) HDfprintf(stderr, "%s", err4);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
}
return new_type;
}
-hid_t createInputDataType(struct Input *in)
+hid_t
+createInputDataType(struct Input *in)
{
hid_t new_type = (-1);
- const char *err1 = "Invalid value for input class.\n";
- const char *err2 = "Invalid value for input size.\n";
- const char *err3 = "Invalid value for input byte order.\n";
- const char *err4 = "Invalid value for output architecture.\n";
- const char *err5 = "STD not supported for float.\n";
- const char *err6 = "IEEE not supported for INT.\n";
+ const char *err1 = "Invalid value for input class.\n";
+ const char *err2 = "Invalid value for input size.\n";
+ const char *err3 = "Invalid value for input byte order.\n";
+ const char *err4 = "Invalid value for output architecture.\n";
+ const char *err5 = "STD not supported for float.\n";
+ const char *err6 = "IEEE not supported for INT.\n";
if (in->h5dumpInput) {
switch (in->inputClass) {
- case 4:
- switch (in->inputArchitecture) {
- case 0: /*NATIVE*/
- switch (in->inputSize) {
- case 8:
- new_type = H5Tcopy(H5T_NATIVE_CHAR);
- break;
-
- case 16:
- new_type = H5Tcopy(H5T_NATIVE_SHORT);
- break;
-
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_INT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_LLONG);
- break;
+ case 4:
+ switch (in->inputArchitecture) {
+ case 0: /*NATIVE*/
+ switch (in->inputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_CHAR);
+ break;
+
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_SHORT);
+ break;
+
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_INT);
+ break;
+
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_LLONG);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->inputByteOrder) {
+ case -1: /* default */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
+
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- switch (in->inputByteOrder) {
- case -1: /* default */
- break;
- case 0:
- H5Tset_order(new_type, H5T_ORDER_BE);
- break;
+ case 1: /*STD*/
+ switch (in->inputSize) {
+ case 8:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I8BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I8LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 16:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I16BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I16LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 32:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I32BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I32LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_I64BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_I64LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- case 1:
- H5Tset_order(new_type, H5T_ORDER_LE);
- break;
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
+ default:
+ (void)HDfprintf(stderr, "%s", err4);
+ return (-1);
}
break;
- case 1: /*STD*/
- switch (in->inputSize) {
- case 8:
- switch (in->inputByteOrder) {
- case -1:
+ case 3:
+ switch (in->inputArchitecture) {
case 0:
- new_type = H5Tcopy(H5T_STD_I8BE);
+ switch (in->inputSize) {
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_FLOAT);
+ break;
+
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->inputByteOrder) {
+ case -1: /* DEFAULT */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
+
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
break;
case 1:
- new_type = H5Tcopy(H5T_STD_I8LE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err5);
return (-1);
- }
- break;
- case 16:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_I16BE);
- break;
+ case 2:
+ switch (in->inputSize) {
+ case 32:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_IEEE_F32BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_IEEE_F32LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_IEEE_F64BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_IEEE_F64LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- case 1:
- new_type = H5Tcopy(H5T_STD_I16LE);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
break;
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err4);
return (-1);
- }
- break;
+ }
+ break;
- case 32:
- switch (in->inputByteOrder) {
- case -1:
+ case 7:
+ switch (in->inputArchitecture) {
case 0:
- new_type = H5Tcopy(H5T_STD_I32BE);
+ switch (in->inputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_UCHAR);
+ break;
+
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_USHORT);
+ break;
+
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_UINT);
+ break;
+
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_ULLONG);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
+ switch (in->inputByteOrder) {
+ case -1: /* Default */
+ break;
+ case 0:
+ H5Tset_order(new_type, H5T_ORDER_BE);
+ break;
+
+ case 1:
+ H5Tset_order(new_type, H5T_ORDER_LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
break;
case 1:
- new_type = H5Tcopy(H5T_STD_I32LE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ switch (in->inputSize) {
+ case 8:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U8BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U8LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 16:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U16BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U16LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 32:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U32BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U32LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
+
+ case 64:
+ switch (in->inputByteOrder) {
+ case -1:
+ case 0:
+ new_type = H5Tcopy(H5T_STD_U64BE);
+ break;
+
+ case 1:
+ new_type = H5Tcopy(H5T_STD_U64LE);
+ break;
+
+ default:
+ (void)HDfprintf(stderr, "%s", err3);
+ return (-1);
+ }
+ break;
- case 64:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_I64BE);
+ default:
+ (void)HDfprintf(stderr, "%s", err2);
+ return (-1);
+ }
break;
- case 1:
- new_type = H5Tcopy(H5T_STD_I64LE);
- break;
+ case 2:
+ (void)HDfprintf(stderr, "%s", err6);
+ return (-1);
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err4);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
}
break;
default:
- (void) HDfprintf(stderr, "%s", err4);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
- }
- break;
-
- case 3:
- switch (in->inputArchitecture) {
+ }
+ }
+ else {
+ switch (in->inputClass) {
case 0:
+ case 4:
switch (in->inputSize) {
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_FLOAT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- switch (in->inputByteOrder) {
- case -1: /* DEFAULT */
- break;
- case 0:
- H5Tset_order(new_type, H5T_ORDER_BE);
- break;
-
- case 1:
- H5Tset_order(new_type, H5T_ORDER_LE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
-
- case 1:
- (void) HDfprintf(stderr, "%s", err5);
- return (-1);
-
- case 2:
- switch (in->inputSize) {
- case 32:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_IEEE_F32BE);
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_CHAR);
break;
- case 1:
- new_type = H5Tcopy(H5T_IEEE_F32LE);
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_SHORT);
break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
-
- case 64:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_IEEE_F64BE);
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_INT);
break;
- case 1:
- new_type = H5Tcopy(H5T_IEEE_F64LE);
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_LLONG);
break;
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err4);
- return (-1);
- }
- break;
-
- case 7:
- switch (in->inputArchitecture) {
- case 0:
- switch (in->inputSize) {
- case 8:
- new_type = H5Tcopy(H5T_NATIVE_UCHAR);
- break;
-
- case 16:
- new_type = H5Tcopy(H5T_NATIVE_USHORT);
- break;
-
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_UINT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_ULLONG);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- switch (in->inputByteOrder) {
- case -1: /* Default */
- break;
- case 0:
- H5Tset_order(new_type, H5T_ORDER_BE);
- break;
-
- case 1:
- H5Tset_order(new_type, H5T_ORDER_LE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
}
break;
case 1:
+ case 2:
+ case 3:
switch (in->inputSize) {
- case 8:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U8BE);
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_FLOAT);
break;
- case 1:
- new_type = H5Tcopy(H5T_STD_U8LE);
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
break;
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
- break;
-
- case 16:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U16BE);
- break;
-
- case 1:
- new_type = H5Tcopy(H5T_STD_U16LE);
- break;
+ }
+ break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
+ case 5:
+ (void)HDfprintf(stderr, "%s", err1);
+ return (-1);
+ break;
- case 32:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U32BE);
+ case 6:
+ case 7:
+ switch (in->inputSize) {
+ case 8:
+ new_type = H5Tcopy(H5T_NATIVE_UCHAR);
break;
- case 1:
- new_type = H5Tcopy(H5T_STD_U32LE);
+ case 16:
+ new_type = H5Tcopy(H5T_NATIVE_USHORT);
break;
- default:
- (void) HDfprintf(stderr, "%s", err3);
- return (-1);
- }
- break;
-
- case 64:
- switch (in->inputByteOrder) {
- case -1:
- case 0:
- new_type = H5Tcopy(H5T_STD_U64BE);
+ case 32:
+ new_type = H5Tcopy(H5T_NATIVE_UINT);
break;
- case 1:
- new_type = H5Tcopy(H5T_STD_U64LE);
+ case 64:
+ new_type = H5Tcopy(H5T_NATIVE_ULLONG);
break;
default:
- (void) HDfprintf(stderr, "%s", err3);
+ (void)HDfprintf(stderr, "%s", err2);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
}
break;
- case 2:
- (void) HDfprintf(stderr, "%s", err6);
- return (-1);
-
default:
- (void) HDfprintf(stderr, "%s", err4);
+ (void)HDfprintf(stderr, "%s", err1);
return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- }
- }
- else {
- switch (in->inputClass) {
- case 0:
- case 4:
- switch (in->inputSize) {
- case 8:
- new_type = H5Tcopy(H5T_NATIVE_CHAR);
- break;
-
- case 16:
- new_type = H5Tcopy(H5T_NATIVE_SHORT);
- break;
-
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_INT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_LLONG);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
-
- case 1:
- case 2:
- case 3:
- switch (in->inputSize) {
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_FLOAT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_DOUBLE);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
-
- case 5:
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
- break;
-
- case 6:
- case 7:
- switch (in->inputSize) {
- case 8:
- new_type = H5Tcopy(H5T_NATIVE_UCHAR);
- break;
-
- case 16:
- new_type = H5Tcopy(H5T_NATIVE_USHORT);
- break;
-
- case 32:
- new_type = H5Tcopy(H5T_NATIVE_UINT);
- break;
-
- case 64:
- new_type = H5Tcopy(H5T_NATIVE_ULLONG);
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err2);
- return (-1);
- }
- break;
-
- default:
- (void) HDfprintf(stderr, "%s", err1);
- return (-1);
}
}
return new_type;
}
-static int process(struct Options *opt)
+static int
+process(struct Options *opt)
{
- struct Input *in;
- FILE *extfile;
- hid_t file_id;
- hid_t group_id;
- hid_t handle;
- hid_t dataset;
- hid_t dataspace = (-1);
- hid_t intype;
- hid_t outtype;
- hid_t proplist;
- hsize_t numOfElements = 1;
- int j;
- int k;
+ struct Input *in;
+ FILE * extfile;
+ hid_t file_id;
+ hid_t group_id;
+ hid_t handle;
+ hid_t dataset;
+ hid_t dataspace = (-1);
+ hid_t intype;
+ hid_t outtype;
+ hid_t proplist;
+ hsize_t numOfElements = 1;
+ int j;
+ int k;
const char *err1 = "Error creating HDF output file: %s.\n";
const char *err2 = "Error in processing the configuration file: %s.\n";
const char *err3 = "Error in reading the input file: %s.\n";
const char *err4 = "Error in creating or opening external file.\n";
- const char *err5 = "Error in creating the output data set. Dataset with the same name may exist at the specified path\n";
+ const char *err5 =
+ "Error in creating the output data set. Dataset with the same name may exist at the specified path\n";
const char *err6 = "Error in writing the output data set.\n";
H5E_BEGIN_TRY
{
if ((file_id = H5Fopen(opt->outfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) {
if ((file_id = H5Fcreate(opt->outfile, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == FAIL) {
- (void) HDfprintf(stderr, err1, opt->outfile);
+ (void)HDfprintf(stderr, err1, opt->outfile);
return (-1);
}
}
@@ -4593,13 +4642,13 @@ static int process(struct Options *opt)
in = &(opt->infiles[k].in);
if (opt->infiles[k].config == 1) {
if (processConfigurationFile(opt->infiles[k].configfile, in) == -1) {
- (void) HDfprintf(stderr, err2, opt->infiles[k].configfile);
+ (void)HDfprintf(stderr, err2, opt->infiles[k].configfile);
return (-1);
}
}
if (processDataFile(opt->infiles[k].datafile, in, file_id) == -1) {
- (void) HDfprintf(stderr, err3, opt->infiles[k].datafile);
+ (void)HDfprintf(stderr, err3, opt->infiles[k].datafile);
return (-1);
}
@@ -4612,13 +4661,15 @@ static int process(struct Options *opt)
{
/* create parent groups */
if (in->path.count > 1) {
- j = 0;
+ j = 0;
handle = file_id;
while (j < in->path.count - 1) {
if ((group_id = H5Gopen2(handle, in->path.group[j], H5P_DEFAULT)) < 0) {
- group_id = H5Gcreate2(handle, in->path.group[j++], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group_id = H5Gcreate2(handle, in->path.group[j++], H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
for (; j < in->path.count - 1; j++)
- group_id = H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group_id = H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT,
+ H5P_DEFAULT);
handle = group_id;
break;
}
@@ -4628,7 +4679,7 @@ static int process(struct Options *opt)
}
else {
handle = file_id;
- j = 0;
+ j = 0;
}
/*enable error reporting */
@@ -4636,7 +4687,7 @@ static int process(struct Options *opt)
H5E_END_TRY;
/*create data type */
- intype = createInputDataType(in);
+ intype = createInputDataType(in);
outtype = createOutputDataType(in);
#ifdef H5DEBUGIMPORT
HDprintf("process intype %ld outtype %ld\n", intype, outtype);
@@ -4651,20 +4702,21 @@ static int process(struct Options *opt)
}
if (in->configOptionVector[COMPRESS] == 1) {
- H5Pset_deflate(proplist, (unsigned) in->compressionParam);
+ H5Pset_deflate(proplist, (unsigned)in->compressionParam);
}
if (in->configOptionVector[EXTERNALSTORE] == 1) {
/* creating the external file if it doesnt exist */
if ((extfile = HDfopen(in->externFilename, "ab")) == NULL) {
- (void) HDfprintf(stderr, "%s", err4);
+ (void)HDfprintf(stderr, "%s", err4);
H5Pclose(proplist);
H5Sclose(dataspace);
H5Fclose(file_id);
return (-1);
}
HDfclose(extfile);
- H5Pset_external(proplist, in->externFilename, (off_t)0, numOfElements * (hsize_t)in->inputSize / 8);
+ H5Pset_external(proplist, in->externFilename, (off_t)0,
+ numOfElements * (hsize_t)in->inputSize / 8);
}
/* create dataspace */
@@ -4677,8 +4729,9 @@ static int process(struct Options *opt)
H5E_BEGIN_TRY
{
/* create data set */
- if ((dataset = H5Dcreate2(handle, in->path.group[j], outtype, dataspace, H5P_DEFAULT, proplist, H5P_DEFAULT)) < 0) {
- (void) HDfprintf(stderr, "%s", err5);
+ if ((dataset = H5Dcreate2(handle, in->path.group[j], outtype, dataspace, H5P_DEFAULT,
+ proplist, H5P_DEFAULT)) < 0) {
+ (void)HDfprintf(stderr, "%s", err5);
H5Pclose(proplist);
H5Sclose(dataspace);
H5Fclose(file_id);
@@ -4690,8 +4743,8 @@ static int process(struct Options *opt)
H5E_END_TRY;
/* write dataset */
- if (H5Dwrite(dataset, intype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (VOIDP) in->data) < 0) {
- (void) HDfprintf(stderr, "%s", err6);
+ if (H5Dwrite(dataset, intype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (VOIDP)in->data) < 0) {
+ (void)HDfprintf(stderr, "%s", err6);
H5Dclose(dataset);
H5Pclose(proplist);
H5Sclose(dataspace);
@@ -4710,36 +4763,44 @@ static int process(struct Options *opt)
return (0);
}
-uint16_t swap_uint16(uint16_t val)
+uint16_t
+swap_uint16(uint16_t val)
{
return (uint16_t)((val << 8) | (val >> 8));
}
-int16_t swap_int16(int16_t val)
+int16_t
+swap_int16(int16_t val)
{
return (int16_t)((val << 8) | ((val >> 8) & 0xFF));
}
-uint32_t swap_uint32(uint32_t val)
+uint32_t
+swap_uint32(uint32_t val)
{
val = ((val << 8) & 0xFF00FF00) | ((val >> 8) & 0xFF00FF);
return (val << 16) | (val >> 16);
}
-int32_t swap_int32(int32_t val)
+int32_t
+swap_int32(int32_t val)
{
val = (int32_t)(((uint32_t)(val << 8) & 0xFF00FF00) | ((val >> 8) & 0xFF00FF));
return (val << 16) | ((val >> 16) & 0xFFFF);
}
-int64_t swap_int64(int64_t val)
+int64_t
+swap_int64(int64_t val)
{
- val = (int64_t)(((uint64_t)(val << 8) & 0xFF00FF00FF00FF00ULL) | ((uint64_t)(val >> 8) & 0x00FF00FF00FF00FFULL));
- val = (int64_t)(((uint64_t)(val << 16) & 0xFFFF0000FFFF0000ULL) | ((uint64_t)(val >> 16) & 0x0000FFFF0000FFFFULL));
+ val = (int64_t)(((uint64_t)(val << 8) & 0xFF00FF00FF00FF00ULL) |
+ ((uint64_t)(val >> 8) & 0x00FF00FF00FF00FFULL));
+ val = (int64_t)(((uint64_t)(val << 16) & 0xFFFF0000FFFF0000ULL) |
+ ((uint64_t)(val >> 16) & 0x0000FFFF0000FFFFULL));
return (int64_t)((uint64_t)(val << 32) | ((uint64_t)(val >> 32) & 0xFFFFFFFFULL));
}
-uint64_t swap_uint64(uint64_t val)
+uint64_t
+swap_uint64(uint64_t val)
{
val = ((val << 8) & 0xFF00FF00FF00FF00ULL) | ((val >> 8) & 0x00FF00FF00FF00FFULL);
val = ((val << 16) & 0xFFFF0000FFFF0000ULL) | ((val >> 16) & 0x0000FFFF0000FFFFULL);
@@ -4754,414 +4815,297 @@ uint64_t swap_uint64(uint64_t val)
* Print a helpful summary of command usage and features.
*/
-void help(char *name)
+void
+help(char *name)
{
- (void) HDfprintf(stdout, "Name:\n\n");
- (void) HDfprintf(stdout, "\t%s\n\n", name);
- (void) HDfprintf(stdout, "\t TOOL NAME:\n");
- (void) HDfprintf(stdout, "\t %s\n", name);
- (void) HDfprintf(stdout, "\t SYNTAX:\n");
- (void) HDfprintf(stdout, "\t %s -h[elp], OR\n", name);
- (void) HDfprintf(stdout,
- "\t %s <infile> -c[onfig] <configfile> [<infile> -c[config] <configfile>...]", name);
- (void) HDfprintf(stdout, "\t\t\t\t -o[utfile] <outfile>\n\n");
- (void) HDfprintf(stdout, "\t PURPOSE:\n");
- (void) HDfprintf(stdout,
- "\t To convert data stored in one or more ASCII or binary files\n");
- (void) HDfprintf(stdout,
- "\t into one or more datasets (in accordance with the \n");
- (void) HDfprintf(stdout,
- "\t user-specified type and storage properties) in an existing \n");
- (void) HDfprintf(stdout, "\t or new HDF5 file.\n\n");
- (void) HDfprintf(stdout, "\t DESCRIPTION:\n");
- (void) HDfprintf(stdout,
- "\t The primary objective of the utility is to convert floating\n");
- (void) HDfprintf(stdout,
- "\t point or integer data stored in ASCII text or binary form \n");
- (void) HDfprintf(stdout,
- "\t into a data-set according to the type and storage properties\n");
- (void) HDfprintf(stdout,
- "\t specified by the user. The utility can also accept ASCII\n");
- (void) HDfprintf(stdout,
- "\t text files and store the contents in a compact form as an\n");
- (void) HDfprintf(stdout, "\t array of one-dimensional strings.\n\n");
- (void) HDfprintf(stdout,
- "\t The input data to be written as a data-set can be provided\n");
- (void) HDfprintf(stdout, "\t to the utility in one of the following forms:\n");
- (void) HDfprintf(stdout,
- "\t 1. ASCII text file with numeric data (floating point or \n");
- (void) HDfprintf(stdout, "\t integer data). \n");
- (void) HDfprintf(stdout,
- "\t 2. Binary file with native floating point data (32-bit or \n");
- (void) HDfprintf(stdout, "\t 64-bit) \n");
- (void) HDfprintf(stdout,
- "\t 3. Binary file with native integer (signed or unsigned)\n");
- (void) HDfprintf(stdout, "\t data (8-bit or 16-bit or 32-bit or 64-bit). \n");
- (void) HDfprintf(stdout,
- "\t 4. ASCII text file containing strings (text data).\n");
- (void) HDfprintf(stdout, "\t \n");
- (void) HDfprintf(stdout,
- "\t Every input file is associated with a configuration file \n");
- (void) HDfprintf(stdout,
- "\t also provided as an input to the utility. (See Section \n");
- (void) HDfprintf(stdout,
- "\t \"CONFIGURATION FILE\" to know how it is to be organized).\n");
- (void) HDfprintf(stdout,
- "\t The class, size and dimensions of the input data is \n");
- (void) HDfprintf(stdout,
- "\t specified in this configuration file. A point to note is\n");
- (void) HDfprintf(stdout,
- "\t that the floating point data in the ASCII text file may be\n");
- (void) HDfprintf(stdout,
- "\t organized in the fixed floating form (for example 323.56)\n");
- (void) HDfprintf(stdout,
- "\t or in a scientific notation (for example 3.23E+02). A \n");
- (void) HDfprintf(stdout,
- "\t different input-class specification is to be used for both\n");
- (void) HDfprintf(stdout, "\t forms.\n\n");
- (void) HDfprintf(stdout,
- "\t The utility extracts the input data from the input file \n");
- (void) HDfprintf(stdout,
- "\t according to the specified parameters and saves it into \n");
- (void) HDfprintf(stdout, "\t an H5 dataset. \n\n");
- (void) HDfprintf(stdout,
- "\t The user can specify output type and storage properties in \n");
- (void) HDfprintf(stdout,
- "\t the configuration file. The user is required to specify the \n");
- (void) HDfprintf(stdout,
- "\t path of the dataset. If the groups in the path leading to \n");
- (void) HDfprintf(stdout,
- "\t the data-set do not exist, the groups will be created by the\n");
- (void) HDfprintf(stdout,
- "\t utility. If no group is specified, the dataset will be\n");
- (void) HDfprintf(stdout, "\t created under the root group.\n\n");
- (void) HDfprintf(stdout,
- "\t In addition to the name, the user is also required to \n");
- (void) HDfprintf(stdout,
- "\t provide the class and size of output data to be written to \n");
- (void) HDfprintf(stdout,
- "\t the dataset and may optionally specify the output-architecture,\n");
- (void) HDfprintf(stdout,
- "\t and the output-byte-order. If output-architecture is not \n");
- (void) HDfprintf(stdout,
- "\t specified the default is NATIVE. Output-byte-orders are fixed\n");
- (void) HDfprintf(stdout,
- "\t for some architectures and may be specified only if output-\n");
- (void) HDfprintf(stdout, "\t architecture is IEEE, UNIX or STD.\n\n");
- (void) HDfprintf(stdout,
- "\t Also, layout and other storage properties such as \n");
- (void) HDfprintf(stdout,
- "\t compression, external storage and extendible data-sets may be\n");
- (void) HDfprintf(stdout,
- "\t optionally specified. The layout and storage properties \n");
- (void) HDfprintf(stdout,
- "\t denote how raw data is to be organized on the disk. If these \n");
- (void) HDfprintf(stdout,
- "\t options are not specified the default is Contiguous layout \n");
- (void) HDfprintf(stdout, "\t and storage.\n\n");
- (void) HDfprintf(stdout,
- "\t The dataset can be organized in any of the following ways:\n");
- (void) HDfprintf(stdout, "\t 1. Contiguous.\n");
- (void) HDfprintf(stdout, "\t 2. Chunked.\n");
- (void) HDfprintf(stdout,
- "\t 3. External Storage File (has to be contiguous)\n");
- (void) HDfprintf(stdout,
- "\t 4. Extendible data sets (has to be chunked)\n");
- (void) HDfprintf(stdout, "\t 5. Compressed. (has to be chunked)\n");
- (void) HDfprintf(stdout,
- "\t 6. Compressed & Extendible (has to be chunked)\n\n");
- (void) HDfprintf(stdout,
- "\t If the user wants to store raw data in a non-HDF file then \n");
- (void) HDfprintf(stdout,
- "\t the external storage file option is to be used and the name \n");
- (void) HDfprintf(stdout, "\t of the file is to be specified. \n\n");
- (void) HDfprintf(stdout,
- "\t If the user wants the dimensions of the data-set to be\n");
- (void) HDfprintf(stdout,
- "\t unlimited, the extendible data set option can be chosen. \n\n");
- (void) HDfprintf(stdout,
- "\t The user may also specify the type of compression and the \n");
- (void) HDfprintf(stdout,
- "\t level to which the data set must be compresses by setting \n");
- (void) HDfprintf(stdout, "\t the compressed option.\n\n");
- (void) HDfprintf(stdout, "\t SYNOPSIS:\n");
- (void) HDfprintf(stdout, "\t h5import -h[elp], OR\n");
- (void) HDfprintf( stdout,
- "\t h5import <infile> -c[onfig] <configfile> \
+ (void)HDfprintf(stdout, "Name:\n\n");
+ (void)HDfprintf(stdout, "\t%s\n\n", name);
+ (void)HDfprintf(stdout, "\t TOOL NAME:\n");
+ (void)HDfprintf(stdout, "\t %s\n", name);
+ (void)HDfprintf(stdout, "\t SYNTAX:\n");
+ (void)HDfprintf(stdout, "\t %s -h[elp], OR\n", name);
+ (void)HDfprintf(stdout, "\t %s <infile> -c[onfig] <configfile> [<infile> -c[config] <configfile>...]",
+ name);
+ (void)HDfprintf(stdout, "\t\t\t\t -o[utfile] <outfile>\n\n");
+ (void)HDfprintf(stdout, "\t PURPOSE:\n");
+ (void)HDfprintf(stdout, "\t To convert data stored in one or more ASCII or binary files\n");
+ (void)HDfprintf(stdout, "\t into one or more datasets (in accordance with the \n");
+ (void)HDfprintf(stdout, "\t user-specified type and storage properties) in an existing \n");
+ (void)HDfprintf(stdout, "\t or new HDF5 file.\n\n");
+ (void)HDfprintf(stdout, "\t DESCRIPTION:\n");
+ (void)HDfprintf(stdout, "\t The primary objective of the utility is to convert floating\n");
+ (void)HDfprintf(stdout, "\t point or integer data stored in ASCII text or binary form \n");
+ (void)HDfprintf(stdout, "\t into a data-set according to the type and storage properties\n");
+ (void)HDfprintf(stdout, "\t specified by the user. The utility can also accept ASCII\n");
+ (void)HDfprintf(stdout, "\t text files and store the contents in a compact form as an\n");
+ (void)HDfprintf(stdout, "\t array of one-dimensional strings.\n\n");
+ (void)HDfprintf(stdout, "\t The input data to be written as a data-set can be provided\n");
+ (void)HDfprintf(stdout, "\t to the utility in one of the following forms:\n");
+ (void)HDfprintf(stdout, "\t 1. ASCII text file with numeric data (floating point or \n");
+ (void)HDfprintf(stdout, "\t integer data). \n");
+ (void)HDfprintf(stdout, "\t 2. Binary file with native floating point data (32-bit or \n");
+ (void)HDfprintf(stdout, "\t 64-bit) \n");
+ (void)HDfprintf(stdout, "\t 3. Binary file with native integer (signed or unsigned)\n");
+ (void)HDfprintf(stdout, "\t data (8-bit or 16-bit or 32-bit or 64-bit). \n");
+ (void)HDfprintf(stdout, "\t 4. ASCII text file containing strings (text data).\n");
+ (void)HDfprintf(stdout, "\t \n");
+ (void)HDfprintf(stdout, "\t Every input file is associated with a configuration file \n");
+ (void)HDfprintf(stdout, "\t also provided as an input to the utility. (See Section \n");
+ (void)HDfprintf(stdout, "\t \"CONFIGURATION FILE\" to know how it is to be organized).\n");
+ (void)HDfprintf(stdout, "\t The class, size and dimensions of the input data is \n");
+ (void)HDfprintf(stdout, "\t specified in this configuration file. A point to note is\n");
+ (void)HDfprintf(stdout, "\t that the floating point data in the ASCII text file may be\n");
+ (void)HDfprintf(stdout, "\t organized in the fixed floating form (for example 323.56)\n");
+ (void)HDfprintf(stdout, "\t or in a scientific notation (for example 3.23E+02). A \n");
+ (void)HDfprintf(stdout, "\t different input-class specification is to be used for both\n");
+ (void)HDfprintf(stdout, "\t forms.\n\n");
+ (void)HDfprintf(stdout, "\t The utility extracts the input data from the input file \n");
+ (void)HDfprintf(stdout, "\t according to the specified parameters and saves it into \n");
+ (void)HDfprintf(stdout, "\t an H5 dataset. \n\n");
+ (void)HDfprintf(stdout, "\t The user can specify output type and storage properties in \n");
+ (void)HDfprintf(stdout, "\t the configuration file. The user is required to specify the \n");
+ (void)HDfprintf(stdout, "\t path of the dataset. If the groups in the path leading to \n");
+ (void)HDfprintf(stdout, "\t the data-set do not exist, the groups will be created by the\n");
+ (void)HDfprintf(stdout, "\t utility. If no group is specified, the dataset will be\n");
+ (void)HDfprintf(stdout, "\t created under the root group.\n\n");
+ (void)HDfprintf(stdout, "\t In addition to the name, the user is also required to \n");
+ (void)HDfprintf(stdout, "\t provide the class and size of output data to be written to \n");
+ (void)HDfprintf(stdout, "\t the dataset and may optionally specify the output-architecture,\n");
+ (void)HDfprintf(stdout, "\t and the output-byte-order. If output-architecture is not \n");
+ (void)HDfprintf(stdout, "\t specified the default is NATIVE. Output-byte-orders are fixed\n");
+ (void)HDfprintf(stdout, "\t for some architectures and may be specified only if output-\n");
+ (void)HDfprintf(stdout, "\t architecture is IEEE, UNIX or STD.\n\n");
+ (void)HDfprintf(stdout, "\t Also, layout and other storage properties such as \n");
+ (void)HDfprintf(stdout, "\t compression, external storage and extendible data-sets may be\n");
+ (void)HDfprintf(stdout, "\t optionally specified. The layout and storage properties \n");
+ (void)HDfprintf(stdout, "\t denote how raw data is to be organized on the disk. If these \n");
+ (void)HDfprintf(stdout, "\t options are not specified the default is Contiguous layout \n");
+ (void)HDfprintf(stdout, "\t and storage.\n\n");
+ (void)HDfprintf(stdout, "\t The dataset can be organized in any of the following ways:\n");
+ (void)HDfprintf(stdout, "\t 1. Contiguous.\n");
+ (void)HDfprintf(stdout, "\t 2. Chunked.\n");
+ (void)HDfprintf(stdout, "\t 3. External Storage File (has to be contiguous)\n");
+ (void)HDfprintf(stdout, "\t 4. Extendible data sets (has to be chunked)\n");
+ (void)HDfprintf(stdout, "\t 5. Compressed. (has to be chunked)\n");
+ (void)HDfprintf(stdout, "\t 6. Compressed & Extendible (has to be chunked)\n\n");
+ (void)HDfprintf(stdout, "\t If the user wants to store raw data in a non-HDF file then \n");
+ (void)HDfprintf(stdout, "\t the external storage file option is to be used and the name \n");
+ (void)HDfprintf(stdout, "\t of the file is to be specified. \n\n");
+ (void)HDfprintf(stdout, "\t If the user wants the dimensions of the data-set to be\n");
+ (void)HDfprintf(stdout, "\t unlimited, the extendible data set option can be chosen. \n\n");
+ (void)HDfprintf(stdout, "\t The user may also specify the type of compression and the \n");
+ (void)HDfprintf(stdout, "\t level to which the data set must be compresses by setting \n");
+ (void)HDfprintf(stdout, "\t the compressed option.\n\n");
+ (void)HDfprintf(stdout, "\t SYNOPSIS:\n");
+ (void)HDfprintf(stdout, "\t h5import -h[elp], OR\n");
+ (void)HDfprintf(stdout, "\t h5import <infile> -c[onfig] <configfile> \
[<infile> -c[config] <confile2>...] -o[utfile] <outfile>\n\n");
- (void) HDfprintf(stdout, "\t -h[elp]:\n");
- (void) HDfprintf(stdout,
- "\t Prints this summary of usage, and exits.\n\n");
- (void) HDfprintf(stdout, "\t <infile(s)>:\n");
- (void) HDfprintf(stdout,
- "\t Name of the Input file(s), containing a \n");
- (void) HDfprintf(stdout,
- "\t single n-dimensional floating point or integer array \n");
- (void) HDfprintf(stdout,
- "\t in either ASCII text, native floating point(32-bit \n");
- (void) HDfprintf(stdout,
- "\t or 64-bit) or native integer(8-bit or 16-bit or \n");
- (void) HDfprintf(stdout,
- "\t 32-bit or 64-bit). Data to be specified in the order\n");
- (void) HDfprintf(stdout, "\t of fastest changing dimensions first.\n\n");
- (void) HDfprintf(stdout, "\t -c[config] <configfile>:\n");
- (void) HDfprintf(stdout,
- "\t Every input file should be associated with a \n");
- (void) HDfprintf(stdout,
- "\t configuration file and this is done by the -c option.\n");
- (void) HDfprintf(stdout,
- "\t <configfile> is the name of the configuration file.\n");
- (void) HDfprintf(stdout, "\t (See Section \"CONFIGURATION FILE\")\n\n");
- (void) HDfprintf(stdout, "\t -o[utfile] <outfile>:\n");
- (void) HDfprintf(stdout,
- "\t Name of the HDF5 output file. Data from one or more \n");
- (void) HDfprintf(stdout,
- "\t input files are stored as one or more data sets in \n");
- (void) HDfprintf(stdout,
- "\t <outfile>. The output file may be an existing file or \n");
- (void) HDfprintf(stdout,
- "\t it maybe new in which case it will be created.\n\n\n");
- (void) HDfprintf(stdout, "\t CONFIGURATION FILE:\n");
- (void) HDfprintf(stdout,
- "\t The configuration file is an ASCII text file and must be \n");
- (void) HDfprintf(stdout,
- "\t the ddl formatted file (without data values) produced by h5dump \n");
- (void) HDfprintf(stdout,
- "\t when used with the options '-o outfilename -b' of a single dataset (-d) \n");
- (void) HDfprintf(stdout,
- "\t OR organized as \"CONFIG-KEYWORD VALUE\" pairs, one pair on each \n");
- (void) HDfprintf(stdout, "\t line.\n\n");
- (void) HDfprintf(stdout,
- "\t The configuration file may have the following keywords each \n");
- (void) HDfprintf(stdout, "\t followed by an acceptable value.\n\n");
- (void) HDfprintf(stdout, "\t Required KEYWORDS:\n");
- (void) HDfprintf(stdout, "\t PATH\n");
- (void) HDfprintf(stdout, "\t INPUT-CLASS\n");
- (void) HDfprintf(stdout, "\t INPUT-SIZE\n");
- (void) HDfprintf(stdout, "\t INPUT-BYTE-ORDER\n");
- (void) HDfprintf(stdout, "\t RANK\n");
- (void) HDfprintf(stdout, "\t DIMENSION-SIZES\n");
- (void) HDfprintf(stdout, "\t OUTPUT-CLASS\n");
- (void) HDfprintf(stdout, "\t OUTPUT-SIZE\n\n");
- (void) HDfprintf(stdout, "\t Optional KEYWORDS:\n");
- (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE\n");
- (void) HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER\n");
- (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES\n");
- (void) HDfprintf(stdout, "\t COMPRESSION-TYPE\n");
- (void) HDfprintf(stdout, "\t COMPRESSION-PARAM\n");
- (void) HDfprintf(stdout, "\t EXTERNAL-STORAGE\n");
- (void) HDfprintf(stdout, "\t MAXIMUM-DIMENSIONS\n\n\n");
- (void) HDfprintf(stdout, "\t Values for keywords:\n");
- (void) HDfprintf(stdout, "\t PATH:\n");
- (void) HDfprintf(stdout, "\t Strings separated by spaces to represent\n");
- (void) HDfprintf(stdout, "\t the path of the data-set. If the groups in\n");
- (void) HDfprintf(stdout,
- "\t the path do not exist, they will be created. \n");
- (void) HDfprintf(stdout, "\t For example,\n");
- (void) HDfprintf(stdout, "\t PATH grp1/grp2/dataset1\n");
- (void) HDfprintf(stdout, "\t PATH: keyword\n");
- (void) HDfprintf(stdout, "\t grp1: group under the root. If\n");
- (void) HDfprintf(stdout, "\t non-existent will be created.\n");
- (void) HDfprintf(stdout, "\t grp2: group under grp1. If \n");
- (void) HDfprintf(stdout, "\t non-existent will be created \n");
- (void) HDfprintf(stdout, "\t under grp1.\n");
- (void) HDfprintf(stdout, "\t dataset1: the name of the data-set \n");
- (void) HDfprintf(stdout, "\t to be created.\n\n");
- (void) HDfprintf(stdout, "\t INPUT-CLASS:\n");
- (void) HDfprintf(stdout, "\t String denoting the type of input data.\n");
- (void) HDfprintf(stdout, "\t (\"TEXTIN\", \"TEXTFP\", \"FP\", \"IN\", \n");
- (void) HDfprintf(stdout, "\t \"STR\", \"TEXTUIN\", \"UIN\"). \n");
- (void) HDfprintf(stdout,
- "\t INPUT-CLASS \"TEXTIN\" denotes an ASCII text \n");
- (void) HDfprintf(stdout,
- "\t file with signed integer data in ASCII form,\n");
- (void) HDfprintf(stdout,
- "\t INPUT-CLASS \"TEXTUIN\" denotes an ASCII text \n");
- (void) HDfprintf(stdout,
- "\t file with unsigned integer data in ASCII form,\n");
- (void) HDfprintf(stdout,
- "\t \"TEXTFP\" denotes an ASCII text file containing\n");
- (void) HDfprintf(stdout, "\t floating point data in the fixed notation\n");
- (void) HDfprintf(stdout, "\t (325.34),\n");
- (void) HDfprintf(stdout,
- "\t \"FP\" denotes a floating point binary file,\n");
- (void) HDfprintf(stdout,
- "\t \"IN\" denotes a signed integer binary file,\n");
- (void) HDfprintf(stdout,
- "\t \"UIN\" denotes an unsigned integer binary file,\n");
- (void) HDfprintf(stdout, "\t & \"STR\" denotes an ASCII text file the \n");
- (void) HDfprintf(stdout,
- "\t contents of which should be stored as an 1-D \n");
- (void) HDfprintf(stdout, "\t array of strings.\n");
- (void) HDfprintf(stdout, "\t If INPUT-CLASS is \"STR\", then RANK, \n");
- (void) HDfprintf(stdout,
- "\t DIMENSION-SIZES, OUTPUT-CLASS, OUTPUT-SIZE, \n");
- (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE and OUTPUT-BYTE-ORDER \n");
- (void) HDfprintf(stdout, "\t will be ignored.\n\n\n");
- (void) HDfprintf(stdout, "\t INPUT-SIZE:\n");
- (void) HDfprintf(stdout,
- "\t Integer denoting the size of the input data \n");
- (void) HDfprintf(stdout, "\t (8, 16, 32, 64). \n\n");
- (void) HDfprintf(stdout, "\t For floating point,\n");
- (void) HDfprintf(stdout, "\t INPUT-SIZE can be 32 or 64.\n");
- (void) HDfprintf(stdout, "\t For integers (signed and unsigned)\n");
- (void) HDfprintf(stdout, "\t INPUT-SIZE can be 8, 16, 32 or 64.\n\n");
- (void) HDfprintf(stdout, "\t RANK:\n");
- (void) HDfprintf(stdout,
- "\t Integer denoting the number of dimensions.\n\n");
- (void) HDfprintf(stdout, "\t DIMENSION-SIZES:\n");
- (void) HDfprintf(stdout,
- "\t Integers separated by spaces to denote the \n");
- (void) HDfprintf(stdout, "\t dimension sizes for the no. of dimensions \n");
- (void) HDfprintf(stdout, "\t determined by rank.\n\n");
- (void) HDfprintf(stdout, "\t OUTPUT-CLASS:\n");
- (void) HDfprintf(stdout,
- "\t String dentoting data type of the dataset to \n");
- (void) HDfprintf(stdout, "\t be written (\"IN\",\"FP\", \"UIN\")\n\n");
- (void) HDfprintf(stdout, "\t OUTPUT-SIZE:\n");
- (void) HDfprintf(stdout,
- "\t Integer denoting the size of the data in the \n");
- (void) HDfprintf(stdout, "\t output dataset to be written.\n");
- (void) HDfprintf(stdout,
- "\t If OUTPUT-CLASS is \"FP\", OUTPUT-SIZE can be \n");
- (void) HDfprintf(stdout, "\t 32 or 64.\n");
- (void) HDfprintf(stdout,
- "\t If OUTPUT-CLASS is \"IN\" or \"UIN\", OUTPUT-SIZE\n");
- (void) HDfprintf(stdout, "\t can be 8, 16, 32 or 64.\n\n");
- (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE:\n");
- (void) HDfprintf(stdout, "\t STRING denoting the type of output \n");
- (void) HDfprintf(stdout,
- "\t architecture. Can accept the following values\n");
- (void) HDfprintf(stdout, "\t STD\n");
- (void) HDfprintf(stdout, "\t IEEE\n");
- (void) HDfprintf(stdout, "\t INTEL\n");
- (void) HDfprintf(stdout, "\t CRAY\n");
- (void) HDfprintf(stdout, "\t MIPS\n");
- (void) HDfprintf(stdout, "\t ALPHA\n");
- (void) HDfprintf(stdout, "\t NATIVE (default)\n");
- (void) HDfprintf(stdout, "\t UNIX\n\n");
- (void) HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER:\n");
- (void) HDfprintf(stdout,
- "\t String denoting the output-byte-order. Ignored\n");
- (void) HDfprintf(stdout,
- "\t if the OUTPUT-ARCHITECTURE is not specified or\n");
- (void) HDfprintf(stdout, "\t if it is IEEE, UNIX or STD. Can accept the \n");
- (void) HDfprintf(stdout, "\t following values.\n");
- (void) HDfprintf(stdout, "\t BE (default)\n");
- (void) HDfprintf(stdout, "\t LE\n\n");
- (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES:\n");
- (void) HDfprintf(stdout, "\t Integers separated by spaces to denote the \n");
- (void) HDfprintf(stdout,
- "\t dimension sizes of the chunk for the no. of \n");
- (void) HDfprintf(stdout,
- "\t dimensions determined by rank. Required field\n");
- (void) HDfprintf(stdout,
- "\t to denote that the dataset will be stored with\n");
- (void) HDfprintf(stdout,
- "\t chunked storage. If this field is absent the\n");
- (void) HDfprintf(stdout,
- "\t dataset will be stored with contiguous storage.\n\n");
- (void) HDfprintf(stdout, "\t COMPRESSION-TYPE:\n");
- (void) HDfprintf(stdout,
- "\t String denoting the type of compression to be\n");
- (void) HDfprintf(stdout, "\t used with the chunked storage. Requires the\n");
- (void) HDfprintf(stdout,
- "\t CHUNKED-DIMENSION-SIZES to be specified. The only \n");
- (void) HDfprintf(stdout,
- "\t currently supported compression method is GZIP. \n");
- (void) HDfprintf(stdout, "\t Will accept the following value\n");
- (void) HDfprintf(stdout, "\t GZIP\n\n");
- (void) HDfprintf(stdout, "\t COMPRESSION-PARAM:\n");
- (void) HDfprintf(stdout,
- "\t Integer used to denote compression level and \n");
- (void) HDfprintf(stdout, "\t this option is to be always specified when \n");
- (void) HDfprintf(stdout,
- "\t the COMPRESSION-TYPE option is specified. The\n");
- (void) HDfprintf(stdout, "\t values are applicable only to GZIP \n");
- (void) HDfprintf(stdout, "\t compression.\n");
- (void) HDfprintf(stdout, "\t Value 1-9: The level of Compression. \n");
- (void) HDfprintf(stdout, "\t 1 will result in the fastest \n");
- (void) HDfprintf(stdout, "\t compression while 9 will result in \n");
- (void) HDfprintf(stdout, "\t the best compression ratio. The default\n");
- (void) HDfprintf(stdout, "\t level of compression is 6.\n\n");
- (void) HDfprintf(stdout, "\t EXTERNAL-STORAGE:\n");
- (void) HDfprintf(stdout,
- "\t String to denote the name of the non-HDF5 file \n");
- (void) HDfprintf(stdout,
- "\t to store data to. Cannot be used if CHUNKED-\n");
- (void) HDfprintf(stdout,
- "\t DIMENSIONS or COMPRESSION-TYPE or EXTENDIBLE-\n");
- (void) HDfprintf(stdout, "\t DATASET is specified.\n");
- (void) HDfprintf(stdout, "\t Value <external-filename>: the name of the \n");
- (void) HDfprintf(stdout, "\t external file as a string to be used.\n\n");
- (void) HDfprintf(stdout, "\t MAXIMUM-DIMENSIONS:\n");
- (void) HDfprintf(stdout, "\t Integers separated by spaces to denote the \n");
- (void) HDfprintf(stdout, "\t maximum dimension sizes of all the \n");
- (void) HDfprintf(stdout, "\t dimensions determined by rank. Requires the\n");
- (void) HDfprintf(stdout,
- "\t CHUNKED-DIMENSION-SIZES to be specified. A value of \n");
- (void) HDfprintf(stdout, "\t -1 for any dimension implies UNLIMITED \n");
- (void) HDfprintf(stdout,
- "\t DIMENSION size for that particular dimension.\n\n");
- (void) HDfprintf(stdout, "\t EXAMPLES:\n");
- (void) HDfprintf(stdout, "\t 1. Configuration File may look like:\n\n");
- (void) HDfprintf(stdout, "\t PATH work h5 pkamat First-set\n");
- (void) HDfprintf(stdout, "\t INPUT-CLASS TEXTFP\n");
- (void) HDfprintf(stdout, "\t RANK 3\n");
- (void) HDfprintf(stdout, "\t DIMENSION-SIZES 5 2 4\n");
- (void) HDfprintf(stdout, "\t OUTPUT-CLASS FP\n");
- (void) HDfprintf(stdout, "\t OUTPUT-SIZE 64\n");
- (void) HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE IEEE\n");
- (void) HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER LE\n");
- (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 \n\n");
- (void) HDfprintf(stdout,
- "\t The above configuration will accept a floating point array \n");
- (void) HDfprintf(stdout,
- "\t (5 x 2 x 4) in an ASCII file with the rank and dimension sizes \n");
- (void) HDfprintf(stdout,
- "\t specified and will save it in a chunked data-set (of pattern \n");
- (void) HDfprintf(stdout,
- "\t 2 X 2 X 2) of 64-bit floating point in the little-endian order \n");
- (void) HDfprintf(stdout,
- "\t and IEEE architecture. The dataset will be stored at\n");
- (void) HDfprintf(stdout, "\t \"/work/h5/pkamat/First-set\"\n\n");
- (void) HDfprintf(stdout, "\t 2. Another configuration could be:\n\n");
- (void) HDfprintf(stdout, "\t PATH Second-set\n");
- (void) HDfprintf(stdout, "\t INPUT-CLASS IN \n");
- (void) HDfprintf(stdout, "\t RANK 5\n");
- (void) HDfprintf(stdout, "\t DIMENSION-SIZES 6 3 5 2 4\n");
- (void) HDfprintf(stdout, "\t OUTPUT-CLASS IN\n");
- (void) HDfprintf(stdout, "\t OUTPUT-SIZE 32\n");
- (void) HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 2 2\n");
- (void) HDfprintf(stdout, "\t EXTENDIBLE-DATASET 1 3 \n");
- (void) HDfprintf(stdout, "\t COMPRESSION-TYPE GZIP\n");
- (void) HDfprintf(stdout, "\t COMPRESSION-PARAM 7\n\n\n");
- (void) HDfprintf(stdout,
- "\t The above configuration will accept an integer array \n");
- (void) HDfprintf(stdout,
- "\t (6 X 3 X 5 x 2 x 4) in a binary file with the rank and \n");
- (void) HDfprintf(stdout,
- "\t dimension sizes specified and will save it in a chunked data-set\n");
- (void) HDfprintf(stdout,
- "\t (of pattern 2 X 2 X 2 X 2 X 2) of 32-bit floating point in \n");
- (void) HDfprintf(stdout,
- "\t native format (as output-architecture is not specified). The \n");
- (void) HDfprintf(stdout,
- "\t first and the third dimension will be defined as unlimited. The \n");
- (void) HDfprintf(stdout,
- "\t data-set will be compressed using GZIP and a compression level \n");
- (void) HDfprintf(stdout, "\t of 7.\n");
- (void) HDfprintf(stdout,
- "\t The dataset will be stored at \"/Second-set\"\n\n");
+ (void)HDfprintf(stdout, "\t -h[elp]:\n");
+ (void)HDfprintf(stdout, "\t Prints this summary of usage, and exits.\n\n");
+ (void)HDfprintf(stdout, "\t <infile(s)>:\n");
+ (void)HDfprintf(stdout, "\t Name of the Input file(s), containing a \n");
+ (void)HDfprintf(stdout, "\t single n-dimensional floating point or integer array \n");
+ (void)HDfprintf(stdout, "\t in either ASCII text, native floating point(32-bit \n");
+ (void)HDfprintf(stdout, "\t or 64-bit) or native integer(8-bit or 16-bit or \n");
+ (void)HDfprintf(stdout, "\t 32-bit or 64-bit). Data to be specified in the order\n");
+ (void)HDfprintf(stdout, "\t of fastest changing dimensions first.\n\n");
+ (void)HDfprintf(stdout, "\t -c[config] <configfile>:\n");
+ (void)HDfprintf(stdout, "\t Every input file should be associated with a \n");
+ (void)HDfprintf(stdout, "\t configuration file and this is done by the -c option.\n");
+ (void)HDfprintf(stdout, "\t <configfile> is the name of the configuration file.\n");
+ (void)HDfprintf(stdout, "\t (See Section \"CONFIGURATION FILE\")\n\n");
+ (void)HDfprintf(stdout, "\t -o[utfile] <outfile>:\n");
+ (void)HDfprintf(stdout, "\t Name of the HDF5 output file. Data from one or more \n");
+ (void)HDfprintf(stdout, "\t input files are stored as one or more data sets in \n");
+ (void)HDfprintf(stdout, "\t <outfile>. The output file may be an existing file or \n");
+ (void)HDfprintf(stdout, "\t it maybe new in which case it will be created.\n\n\n");
+ (void)HDfprintf(stdout, "\t CONFIGURATION FILE:\n");
+ (void)HDfprintf(stdout, "\t The configuration file is an ASCII text file and must be \n");
+ (void)HDfprintf(stdout, "\t the ddl formatted file (without data values) produced by h5dump \n");
+ (void)HDfprintf(stdout, "\t when used with the options '-o outfilename -b' of a single dataset (-d) \n");
+ (void)HDfprintf(stdout, "\t OR organized as \"CONFIG-KEYWORD VALUE\" pairs, one pair on each \n");
+ (void)HDfprintf(stdout, "\t line.\n\n");
+ (void)HDfprintf(stdout, "\t The configuration file may have the following keywords each \n");
+ (void)HDfprintf(stdout, "\t followed by an acceptable value.\n\n");
+ (void)HDfprintf(stdout, "\t Required KEYWORDS:\n");
+ (void)HDfprintf(stdout, "\t PATH\n");
+ (void)HDfprintf(stdout, "\t INPUT-CLASS\n");
+ (void)HDfprintf(stdout, "\t INPUT-SIZE\n");
+ (void)HDfprintf(stdout, "\t INPUT-BYTE-ORDER\n");
+ (void)HDfprintf(stdout, "\t RANK\n");
+ (void)HDfprintf(stdout, "\t DIMENSION-SIZES\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-CLASS\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-SIZE\n\n");
+ (void)HDfprintf(stdout, "\t Optional KEYWORDS:\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER\n");
+ (void)HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES\n");
+ (void)HDfprintf(stdout, "\t COMPRESSION-TYPE\n");
+ (void)HDfprintf(stdout, "\t COMPRESSION-PARAM\n");
+ (void)HDfprintf(stdout, "\t EXTERNAL-STORAGE\n");
+ (void)HDfprintf(stdout, "\t MAXIMUM-DIMENSIONS\n\n\n");
+ (void)HDfprintf(stdout, "\t Values for keywords:\n");
+ (void)HDfprintf(stdout, "\t PATH:\n");
+ (void)HDfprintf(stdout, "\t Strings separated by spaces to represent\n");
+ (void)HDfprintf(stdout, "\t the path of the data-set. If the groups in\n");
+ (void)HDfprintf(stdout, "\t the path do not exist, they will be created. \n");
+ (void)HDfprintf(stdout, "\t For example,\n");
+ (void)HDfprintf(stdout, "\t PATH grp1/grp2/dataset1\n");
+ (void)HDfprintf(stdout, "\t PATH: keyword\n");
+ (void)HDfprintf(stdout, "\t grp1: group under the root. If\n");
+ (void)HDfprintf(stdout, "\t non-existent will be created.\n");
+ (void)HDfprintf(stdout, "\t grp2: group under grp1. If \n");
+ (void)HDfprintf(stdout, "\t non-existent will be created \n");
+ (void)HDfprintf(stdout, "\t under grp1.\n");
+ (void)HDfprintf(stdout, "\t dataset1: the name of the data-set \n");
+ (void)HDfprintf(stdout, "\t to be created.\n\n");
+ (void)HDfprintf(stdout, "\t INPUT-CLASS:\n");
+ (void)HDfprintf(stdout, "\t String denoting the type of input data.\n");
+ (void)HDfprintf(stdout, "\t (\"TEXTIN\", \"TEXTFP\", \"FP\", \"IN\", \n");
+ (void)HDfprintf(stdout, "\t \"STR\", \"TEXTUIN\", \"UIN\"). \n");
+ (void)HDfprintf(stdout, "\t INPUT-CLASS \"TEXTIN\" denotes an ASCII text \n");
+ (void)HDfprintf(stdout, "\t file with signed integer data in ASCII form,\n");
+ (void)HDfprintf(stdout, "\t INPUT-CLASS \"TEXTUIN\" denotes an ASCII text \n");
+ (void)HDfprintf(stdout, "\t file with unsigned integer data in ASCII form,\n");
+ (void)HDfprintf(stdout, "\t \"TEXTFP\" denotes an ASCII text file containing\n");
+ (void)HDfprintf(stdout, "\t floating point data in the fixed notation\n");
+ (void)HDfprintf(stdout, "\t (325.34),\n");
+ (void)HDfprintf(stdout, "\t \"FP\" denotes a floating point binary file,\n");
+ (void)HDfprintf(stdout, "\t \"IN\" denotes a signed integer binary file,\n");
+ (void)HDfprintf(stdout, "\t \"UIN\" denotes an unsigned integer binary file,\n");
+ (void)HDfprintf(stdout, "\t & \"STR\" denotes an ASCII text file the \n");
+ (void)HDfprintf(stdout, "\t contents of which should be stored as an 1-D \n");
+ (void)HDfprintf(stdout, "\t array of strings.\n");
+ (void)HDfprintf(stdout, "\t If INPUT-CLASS is \"STR\", then RANK, \n");
+ (void)HDfprintf(stdout, "\t DIMENSION-SIZES, OUTPUT-CLASS, OUTPUT-SIZE, \n");
+ (void)HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE and OUTPUT-BYTE-ORDER \n");
+ (void)HDfprintf(stdout, "\t will be ignored.\n\n\n");
+ (void)HDfprintf(stdout, "\t INPUT-SIZE:\n");
+ (void)HDfprintf(stdout, "\t Integer denoting the size of the input data \n");
+ (void)HDfprintf(stdout, "\t (8, 16, 32, 64). \n\n");
+ (void)HDfprintf(stdout, "\t For floating point,\n");
+ (void)HDfprintf(stdout, "\t INPUT-SIZE can be 32 or 64.\n");
+ (void)HDfprintf(stdout, "\t For integers (signed and unsigned)\n");
+ (void)HDfprintf(stdout, "\t INPUT-SIZE can be 8, 16, 32 or 64.\n\n");
+ (void)HDfprintf(stdout, "\t RANK:\n");
+ (void)HDfprintf(stdout, "\t Integer denoting the number of dimensions.\n\n");
+ (void)HDfprintf(stdout, "\t DIMENSION-SIZES:\n");
+ (void)HDfprintf(stdout, "\t Integers separated by spaces to denote the \n");
+ (void)HDfprintf(stdout, "\t dimension sizes for the no. of dimensions \n");
+ (void)HDfprintf(stdout, "\t determined by rank.\n\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-CLASS:\n");
+ (void)HDfprintf(stdout, "\t String dentoting data type of the dataset to \n");
+ (void)HDfprintf(stdout, "\t be written (\"IN\",\"FP\", \"UIN\")\n\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-SIZE:\n");
+ (void)HDfprintf(stdout, "\t Integer denoting the size of the data in the \n");
+ (void)HDfprintf(stdout, "\t output dataset to be written.\n");
+ (void)HDfprintf(stdout, "\t If OUTPUT-CLASS is \"FP\", OUTPUT-SIZE can be \n");
+ (void)HDfprintf(stdout, "\t 32 or 64.\n");
+ (void)HDfprintf(stdout, "\t If OUTPUT-CLASS is \"IN\" or \"UIN\", OUTPUT-SIZE\n");
+ (void)HDfprintf(stdout, "\t can be 8, 16, 32 or 64.\n\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE:\n");
+ (void)HDfprintf(stdout, "\t STRING denoting the type of output \n");
+ (void)HDfprintf(stdout, "\t architecture. Can accept the following values\n");
+ (void)HDfprintf(stdout, "\t STD\n");
+ (void)HDfprintf(stdout, "\t IEEE\n");
+ (void)HDfprintf(stdout, "\t INTEL\n");
+ (void)HDfprintf(stdout, "\t CRAY\n");
+ (void)HDfprintf(stdout, "\t MIPS\n");
+ (void)HDfprintf(stdout, "\t ALPHA\n");
+ (void)HDfprintf(stdout, "\t NATIVE (default)\n");
+ (void)HDfprintf(stdout, "\t UNIX\n\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER:\n");
+ (void)HDfprintf(stdout, "\t String denoting the output-byte-order. Ignored\n");
+ (void)HDfprintf(stdout, "\t if the OUTPUT-ARCHITECTURE is not specified or\n");
+ (void)HDfprintf(stdout, "\t if it is IEEE, UNIX or STD. Can accept the \n");
+ (void)HDfprintf(stdout, "\t following values.\n");
+ (void)HDfprintf(stdout, "\t BE (default)\n");
+ (void)HDfprintf(stdout, "\t LE\n\n");
+ (void)HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES:\n");
+ (void)HDfprintf(stdout, "\t Integers separated by spaces to denote the \n");
+ (void)HDfprintf(stdout, "\t dimension sizes of the chunk for the no. of \n");
+ (void)HDfprintf(stdout, "\t dimensions determined by rank. Required field\n");
+ (void)HDfprintf(stdout, "\t to denote that the dataset will be stored with\n");
+ (void)HDfprintf(stdout, "\t chunked storage. If this field is absent the\n");
+ (void)HDfprintf(stdout, "\t dataset will be stored with contiguous storage.\n\n");
+ (void)HDfprintf(stdout, "\t COMPRESSION-TYPE:\n");
+ (void)HDfprintf(stdout, "\t String denoting the type of compression to be\n");
+ (void)HDfprintf(stdout, "\t used with the chunked storage. Requires the\n");
+ (void)HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES to be specified. The only \n");
+ (void)HDfprintf(stdout, "\t currently supported compression method is GZIP. \n");
+ (void)HDfprintf(stdout, "\t Will accept the following value\n");
+ (void)HDfprintf(stdout, "\t GZIP\n\n");
+ (void)HDfprintf(stdout, "\t COMPRESSION-PARAM:\n");
+ (void)HDfprintf(stdout, "\t Integer used to denote compression level and \n");
+ (void)HDfprintf(stdout, "\t this option is to be always specified when \n");
+ (void)HDfprintf(stdout, "\t the COMPRESSION-TYPE option is specified. The\n");
+ (void)HDfprintf(stdout, "\t values are applicable only to GZIP \n");
+ (void)HDfprintf(stdout, "\t compression.\n");
+ (void)HDfprintf(stdout, "\t Value 1-9: The level of Compression. \n");
+ (void)HDfprintf(stdout, "\t 1 will result in the fastest \n");
+ (void)HDfprintf(stdout, "\t compression while 9 will result in \n");
+ (void)HDfprintf(stdout, "\t the best compression ratio. The default\n");
+ (void)HDfprintf(stdout, "\t level of compression is 6.\n\n");
+ (void)HDfprintf(stdout, "\t EXTERNAL-STORAGE:\n");
+ (void)HDfprintf(stdout, "\t String to denote the name of the non-HDF5 file \n");
+ (void)HDfprintf(stdout, "\t to store data to. Cannot be used if CHUNKED-\n");
+ (void)HDfprintf(stdout, "\t DIMENSIONS or COMPRESSION-TYPE or EXTENDIBLE-\n");
+ (void)HDfprintf(stdout, "\t DATASET is specified.\n");
+ (void)HDfprintf(stdout, "\t Value <external-filename>: the name of the \n");
+ (void)HDfprintf(stdout, "\t external file as a string to be used.\n\n");
+ (void)HDfprintf(stdout, "\t MAXIMUM-DIMENSIONS:\n");
+ (void)HDfprintf(stdout, "\t Integers separated by spaces to denote the \n");
+ (void)HDfprintf(stdout, "\t maximum dimension sizes of all the \n");
+ (void)HDfprintf(stdout, "\t dimensions determined by rank. Requires the\n");
+ (void)HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES to be specified. A value of \n");
+ (void)HDfprintf(stdout, "\t -1 for any dimension implies UNLIMITED \n");
+ (void)HDfprintf(stdout, "\t DIMENSION size for that particular dimension.\n\n");
+ (void)HDfprintf(stdout, "\t EXAMPLES:\n");
+ (void)HDfprintf(stdout, "\t 1. Configuration File may look like:\n\n");
+ (void)HDfprintf(stdout, "\t PATH work h5 pkamat First-set\n");
+ (void)HDfprintf(stdout, "\t INPUT-CLASS TEXTFP\n");
+ (void)HDfprintf(stdout, "\t RANK 3\n");
+ (void)HDfprintf(stdout, "\t DIMENSION-SIZES 5 2 4\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-CLASS FP\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-SIZE 64\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-ARCHITECTURE IEEE\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-BYTE-ORDER LE\n");
+ (void)HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 \n\n");
+ (void)HDfprintf(stdout, "\t The above configuration will accept a floating point array \n");
+ (void)HDfprintf(stdout, "\t (5 x 2 x 4) in an ASCII file with the rank and dimension sizes \n");
+ (void)HDfprintf(stdout, "\t specified and will save it in a chunked data-set (of pattern \n");
+ (void)HDfprintf(stdout, "\t 2 X 2 X 2) of 64-bit floating point in the little-endian order \n");
+ (void)HDfprintf(stdout, "\t and IEEE architecture. The dataset will be stored at\n");
+ (void)HDfprintf(stdout, "\t \"/work/h5/pkamat/First-set\"\n\n");
+ (void)HDfprintf(stdout, "\t 2. Another configuration could be:\n\n");
+ (void)HDfprintf(stdout, "\t PATH Second-set\n");
+ (void)HDfprintf(stdout, "\t INPUT-CLASS IN \n");
+ (void)HDfprintf(stdout, "\t RANK 5\n");
+ (void)HDfprintf(stdout, "\t DIMENSION-SIZES 6 3 5 2 4\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-CLASS IN\n");
+ (void)HDfprintf(stdout, "\t OUTPUT-SIZE 32\n");
+ (void)HDfprintf(stdout, "\t CHUNKED-DIMENSION-SIZES 2 2 2 2 2\n");
+ (void)HDfprintf(stdout, "\t EXTENDIBLE-DATASET 1 3 \n");
+ (void)HDfprintf(stdout, "\t COMPRESSION-TYPE GZIP\n");
+ (void)HDfprintf(stdout, "\t COMPRESSION-PARAM 7\n\n\n");
+ (void)HDfprintf(stdout, "\t The above configuration will accept an integer array \n");
+ (void)HDfprintf(stdout, "\t (6 X 3 X 5 x 2 x 4) in a binary file with the rank and \n");
+ (void)HDfprintf(stdout, "\t dimension sizes specified and will save it in a chunked data-set\n");
+ (void)HDfprintf(stdout, "\t (of pattern 2 X 2 X 2 X 2 X 2) of 32-bit floating point in \n");
+ (void)HDfprintf(stdout, "\t native format (as output-architecture is not specified). The \n");
+ (void)HDfprintf(stdout, "\t first and the third dimension will be defined as unlimited. The \n");
+ (void)HDfprintf(stdout, "\t data-set will be compressed using GZIP and a compression level \n");
+ (void)HDfprintf(stdout, "\t of 7.\n");
+ (void)HDfprintf(stdout, "\t The dataset will be stored at \"/Second-set\"\n\n");
return;
}
-void usage(char *name)
+void
+usage(char *name)
{
- (void) HDfprintf(stdout, "\nUsage:\t%s -h[elp], OR\n", name);
- (void) HDfprintf(stdout,
- "\t%s <infile> -c[onfig] <configfile> \
- [<infile> -c[config] <configfile>...] -o[utfile] <outfile> \n\n", name);
+ (void)HDfprintf(stdout, "\nUsage:\t%s -h[elp], OR\n", name);
+ (void)HDfprintf(stdout, "\t%s <infile> -c[onfig] <configfile> \
+ [<infile> -c[config] <configfile>...] -o[utfile] <outfile> \n\n",
+ name);
return;
}
-
diff --git a/tools/src/h5import/h5import.h b/tools/src/h5import/h5import.h
index 00c41f6..405d953 100644
--- a/tools/src/h5import/h5import.h
+++ b/tools/src/h5import/h5import.h
@@ -25,116 +25,109 @@
*/
#define FILNAME 0
/* filename */
-#define OPT_o 1
+#define OPT_o 1
/* output filename */
-#define OPT_c 2 /* configuration filename */
-#define OPT_h 3 /* request for explanation */
-#define OPT_d 4 /* dimensions */
-#define OPT_p 5 /* pathname */
-#define OPT_t 6 /* data type */
-#define OPT_s 7 /* data size */
-#define ERR 20 /* invalid token */
-
-#define MAX_GROUPS_IN_PATH 20
+#define OPT_c 2 /* configuration filename */
+#define OPT_h 3 /* request for explanation */
+#define OPT_d 4 /* dimensions */
+#define OPT_p 5 /* pathname */
+#define OPT_t 6 /* data type */
+#define OPT_s 7 /* data size */
+#define ERR 20 /* invalid token */
+
+#define MAX_GROUPS_IN_PATH 20
#define MAX_PATH_NAME_LENGTH 255
-#define NUM_KEYS 15
-#define MIN_NUM_DIMENSION 1
-#define MAX_NUM_DIMENSION 32
-#define BASE_10 10
-
-#define PATH 0
-#define INPUT_CLASS 1
-#define INPUT_SIZE 2
-#define RANK 3
-#define DIM 4
-#define OUTPUT_CLASS 5
-#define OUTPUT_SIZE 6
-#define OUTPUT_ARCH 7
-#define OUTPUT_B_ORDER 8
-#define CHUNK 9
-#define COMPRESS 10
-#define COMPRESS_PARAM 11
-#define EXTERNALSTORE 12
-#define EXTEND 13
-#define INPUT_B_ORDER 14
+#define NUM_KEYS 15
+#define MIN_NUM_DIMENSION 1
+#define MAX_NUM_DIMENSION 32
+#define BASE_10 10
+
+#define PATH 0
+#define INPUT_CLASS 1
+#define INPUT_SIZE 2
+#define RANK 3
+#define DIM 4
+#define OUTPUT_CLASS 5
+#define OUTPUT_SIZE 6
+#define OUTPUT_ARCH 7
+#define OUTPUT_B_ORDER 8
+#define CHUNK 9
+#define COMPRESS 10
+#define COMPRESS_PARAM 11
+#define EXTERNALSTORE 12
+#define EXTEND 13
+#define INPUT_B_ORDER 14
/* data types */
-#define H5DT_INT8 signed char
-#define H5DT_INT16 short
-#define H5DT_INT32 int
-#define H5DT_FLOAT32 float
-#define H5DT_FLOAT64 double
-#define VOIDP void*
-#define H5DT_UINT8 unsigned char
-#define H5DT_UINT16 unsigned short
-#define H5DT_UINT32 unsigned int
-#define H5DT_INT64 long long
-#define H5DT_UINT64 unsigned H5DT_INT64
-
-struct path_info
-{
+#define H5DT_INT8 signed char
+#define H5DT_INT16 short
+#define H5DT_INT32 int
+#define H5DT_FLOAT32 float
+#define H5DT_FLOAT64 double
+#define VOIDP void *
+#define H5DT_UINT8 unsigned char
+#define H5DT_UINT16 unsigned short
+#define H5DT_UINT32 unsigned int
+#define H5DT_INT64 long long
+#define H5DT_UINT64 unsigned H5DT_INT64
+
+struct path_info {
char group[MAX_GROUPS_IN_PATH][MAX_PATH_NAME_LENGTH];
- int count;
+ int count;
};
-struct Input
-{
- int h5dumpInput;
+struct Input {
+ int h5dumpInput;
struct path_info path;
- int inputClass;
- int inputSize;
- int inputArchitecture;
- int inputByteOrder;
- int rank;
- hsize_t* sizeOfDimension;
- int outputClass;
- int outputSize;
- int outputArchitecture;
- int outputByteOrder;
- hsize_t* sizeOfChunk;
- hsize_t* maxsizeOfDimension;
- int compressionType;
- int compressionParam;
- char *externFilename;
- VOIDP data;
- int configOptionVector[NUM_KEYS];
+ int inputClass;
+ int inputSize;
+ int inputArchitecture;
+ int inputByteOrder;
+ int rank;
+ hsize_t * sizeOfDimension;
+ int outputClass;
+ int outputSize;
+ int outputArchitecture;
+ int outputByteOrder;
+ hsize_t * sizeOfChunk;
+ hsize_t * maxsizeOfDimension;
+ int compressionType;
+ int compressionParam;
+ char * externFilename;
+ VOIDP data;
+ int configOptionVector[NUM_KEYS];
};
-struct infilesformat
-{
- char datafile[MAX_PATH_NAME_LENGTH];
- char configfile[MAX_PATH_NAME_LENGTH];
+struct infilesformat {
+ char datafile[MAX_PATH_NAME_LENGTH];
+ char configfile[MAX_PATH_NAME_LENGTH];
struct Input in;
- int config; /* Configfile present? No - 0. Yes - 1 */
+ int config; /* Configfile present? No - 0. Yes - 1 */
};
-struct Options
-{
- struct infilesformat infiles[30]; /* structure to hold the list of input file names. Limited to 30*/
- char outfile[256]; /* output file name */
- int fcount; /* number of input files */
+struct Options {
+ struct infilesformat infiles[30]; /* structure to hold the list of input file names. Limited to 30*/
+ char outfile[256]; /* output file name */
+ int fcount; /* number of input files */
};
-char keytable[NUM_KEYS][30] = {
- "PATH",
- "INPUT-CLASS",
- "INPUT-SIZE",
- "RANK",
- "DIMENSION-SIZES",
- "OUTPUT-CLASS",
- "OUTPUT-SIZE",
- "OUTPUT-ARCHITECTURE",
- "OUTPUT-BYTE-ORDER",
- "CHUNKED-DIMENSION-SIZES",
- "COMPRESSION-TYPE",
- "COMPRESSION-PARAM",
- "EXTERNAL-STORAGE",
- "MAXIMUM-DIMENSIONS",
- "INPUT-BYTE-ORDER"
-};
-
-static int state_table[15][8] =
-{
+char keytable[NUM_KEYS][30] = {"PATH",
+ "INPUT-CLASS",
+ "INPUT-SIZE",
+ "RANK",
+ "DIMENSION-SIZES",
+ "OUTPUT-CLASS",
+ "OUTPUT-SIZE",
+ "OUTPUT-ARCHITECTURE",
+ "OUTPUT-BYTE-ORDER",
+ "CHUNKED-DIMENSION-SIZES",
+ "COMPRESSION-TYPE",
+ "COMPRESSION-PARAM",
+ "EXTERNAL-STORAGE",
+ "MAXIMUM-DIMENSIONS",
+ "INPUT-BYTE-ORDER"};
+
+static int state_table[15][8] = {
/* token ordering: FILNAME OPT_o OPT_c OPT_h OPT_d OPT_p OPT_t OPT_s */
/* state 0: start */
@@ -189,12 +182,11 @@ static int state_table[15][8] =
* Function declarations for h5import
*
*/
-void usage(char *);
-void setDefaultValues(struct Input *in, int count);
-void help(char *);
-
-hid_t createOutputDataType(struct Input *in);
-hid_t createInputDataType(struct Input *in);
+void usage(char *);
+void setDefaultValues(struct Input *in, int count);
+void help(char *);
-#endif /* H5IMPORT_H__ */
+hid_t createOutputDataType(struct Input *in);
+hid_t createInputDataType(struct Input *in);
+#endif /* H5IMPORT_H__ */
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
index 56ed66b..e72215e 100644
--- a/tools/src/h5jam/h5jam.c
+++ b/tools/src/h5jam/h5jam.c
@@ -19,36 +19,29 @@
/* Name of tool */
#define PROGRAMNAME "h5jam"
-herr_t write_pad(int ofile, hsize_t old_where, hsize_t *new_where);
-hsize_t compute_user_block_size (hsize_t);
-hsize_t copy_some_to_file (int, int, hsize_t, hsize_t, ssize_t);
-void parse_command_line (int, const char *[]);
+herr_t write_pad(int ofile, hsize_t old_where, hsize_t *new_where);
+hsize_t compute_user_block_size(hsize_t);
+hsize_t copy_some_to_file(int, int, hsize_t, hsize_t, ssize_t);
+void parse_command_line(int, const char *[]);
-int do_clobber = FALSE;
+int do_clobber = FALSE;
char *output_file = NULL;
-char *input_file = NULL;
-char *ub_file = NULL;
+char *input_file = NULL;
+char *ub_file = NULL;
/*
* Command-line options: The user can specify short or long-named
* parameters. The long-named ones can be partially spelled. When
* adding more, make sure that they don't clash with each other.
*/
-static const char *s_opts = "hi:u:o:c:V"; /* add more later ? */
+static const char * s_opts = "hi:u:o:c:V"; /* add more later ? */
static struct long_options l_opts[] = {
- {"help", no_arg, 'h'},
- {"hel", no_arg, 'h'},
- {"i", require_arg, 'i'}, /* input file */
- {"u", require_arg, 'u'}, /* user block file */
- {"o", require_arg, 'o'}, /* output file */
- {"clobber", no_arg, 'c'}, /* clobber existing UB */
- {"clobbe", no_arg, 'c'},
- {"clobb", no_arg, 'c'},
- {"clob", no_arg, 'c'},
- {"clo", no_arg, 'c'},
- {"cl", no_arg, 'c'},
- {NULL, 0, '\0'}
-};
+ {"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {"i", require_arg, 'i'}, /* input file */
+ {"u", require_arg, 'u'}, /* user block file */
+ {"o", require_arg, 'o'}, /* output file */
+ {"clobber", no_arg, 'c'}, /* clobber existing UB */
+ {"clobbe", no_arg, 'c'}, {"clobb", no_arg, 'c'}, {"clob", no_arg, 'c'},
+ {"clo", no_arg, 'c'}, {"cl", no_arg, 'c'}, {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -59,56 +52,35 @@ static struct long_options l_opts[] = {
*-------------------------------------------------------------------------
*/
static void
-usage (const char *prog)
+usage(const char *prog)
{
- HDfflush (stdout);
- HDfprintf (stdout,
- "usage: %s -i <in_file.h5> -u <in_user_file> [-o <out_file.h5>] [--clobber]\n", prog);
- HDfprintf (stdout, "\n");
- HDfprintf (stdout,
- "Adds user block to front of an HDF5 file and creates a new concatenated file.\n");
- HDfprintf (stdout, "\n");
- HDfprintf (stdout,
- "OPTIONS\n");
- HDfprintf (stdout,
- " -i in_file.h5 Specifies the input HDF5 file.\n");
- HDfprintf (stdout,
- " -u in_user_file Specifies the file to be inserted into the user block.\n");
- HDfprintf (stdout,
- " Can be any file format except an HDF5 format.\n");
- HDfprintf (stdout,
- " -o out_file.h5 Specifies the output HDF5 file.\n");
- HDfprintf (stdout,
- " If not specified, the user block will be concatenated in\n");
- HDfprintf (stdout,
- " place to the input HDF5 file.\n");
- HDfprintf (stdout,
- " --clobber Wipes out any existing user block before concatenating\n");
- HDfprintf (stdout,
- " the given user block.\n");
- HDfprintf (stdout,
- " The size of the new user block will be the larger of;\n");
- HDfprintf (stdout,
- " - the size of existing user block in the input HDF5 file\n");
- HDfprintf (stdout,
- " - the size of user block required by new input user file\n");
- HDfprintf (stdout,
- " (size = 512 x 2N, N is positive integer.)\n");
- HDfprintf (stdout, "\n");
- HDfprintf (stdout,
- " -h Prints a usage message and exits.\n");
- HDfprintf (stdout,
- " -V Prints the HDF5 library version and exits.\n");
- HDfprintf (stdout, "\n");
- HDfprintf (stdout,
- "Exit Status:\n");
- HDfprintf (stdout,
- " 0 Succeeded.\n");
- HDfprintf (stdout,
- " >0 An error occurred.\n");
+ HDfflush(stdout);
+ HDfprintf(stdout, "usage: %s -i <in_file.h5> -u <in_user_file> [-o <out_file.h5>] [--clobber]\n", prog);
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, "Adds user block to front of an HDF5 file and creates a new concatenated file.\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, "OPTIONS\n");
+ HDfprintf(stdout, " -i in_file.h5 Specifies the input HDF5 file.\n");
+ HDfprintf(stdout, " -u in_user_file Specifies the file to be inserted into the user block.\n");
+ HDfprintf(stdout, " Can be any file format except an HDF5 format.\n");
+ HDfprintf(stdout, " -o out_file.h5 Specifies the output HDF5 file.\n");
+ HDfprintf(stdout, " If not specified, the user block will be concatenated in\n");
+ HDfprintf(stdout, " place to the input HDF5 file.\n");
+ HDfprintf(stdout, " --clobber Wipes out any existing user block before concatenating\n");
+ HDfprintf(stdout, " the given user block.\n");
+ HDfprintf(stdout, " The size of the new user block will be the larger of;\n");
+ HDfprintf(stdout, " - the size of existing user block in the input HDF5 file\n");
+ HDfprintf(stdout, " - the size of user block required by new input user file\n");
+ HDfprintf(stdout, " (size = 512 x 2N, N is positive integer.)\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, " -h Prints a usage message and exits.\n");
+ HDfprintf(stdout, " -V Prints the HDF5 library version and exits.\n");
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, "Exit Status:\n");
+ HDfprintf(stdout, " 0 Succeeded.\n");
+ HDfprintf(stdout, " >0 An error occurred.\n");
}
-
/*-------------------------------------------------------------------------
* Function: leave
*
@@ -136,40 +108,38 @@ leave(int ret)
*/
void
-parse_command_line (int argc, const char *argv[])
+parse_command_line(int argc, const char *argv[])
{
- int opt = FALSE;
-
- /* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
- {
- switch ((char) opt)
- {
- case 'o':
- output_file = HDstrdup (opt_arg);
- break;
- case 'i':
- input_file = HDstrdup (opt_arg);
- break;
- case 'u':
- ub_file = HDstrdup (opt_arg);
- break;
- case 'c':
- do_clobber = TRUE;
- break;
- case 'h':
- usage (h5tools_getprogname());
- leave (EXIT_SUCCESS);
- break;
- case 'V':
- print_version (h5tools_getprogname());
- leave (EXIT_SUCCESS);
- break;
- case '?':
- default:
- usage (h5tools_getprogname());
- leave (EXIT_FAILURE);
- }
+ int opt = FALSE;
+
+ /* parse command line options */
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
+ case 'o':
+ output_file = HDstrdup(opt_arg);
+ break;
+ case 'i':
+ input_file = HDstrdup(opt_arg);
+ break;
+ case 'u':
+ ub_file = HDstrdup(opt_arg);
+ break;
+ case 'c':
+ do_clobber = TRUE;
+ break;
+ case 'h':
+ usage(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+ break;
+ case 'V':
+ print_version(h5tools_getprogname());
+ leave(EXIT_SUCCESS);
+ break;
+ case '?':
+ default:
+ usage(h5tools_getprogname());
+ leave(EXIT_FAILURE);
+ }
}
}
@@ -183,24 +153,24 @@ parse_command_line (int argc, const char *argv[])
*-------------------------------------------------------------------------
*/
int
-main (int argc, const char *argv[])
+main(int argc, const char *argv[])
{
- int ufid = -1;
- int h5fid = -1;
- int ofid = -1;
- hid_t ifile = H5I_INVALID_HID;
- hid_t plist = H5I_INVALID_HID;
- herr_t status;
- htri_t testval;
- hsize_t usize;
- hsize_t h5fsize;
- hsize_t startub;
- hsize_t where;
- hsize_t newubsize;
- off_t fsize;
- h5_stat_t sbuf;
- h5_stat_t sbuf2;
- int res;
+ int ufid = -1;
+ int h5fid = -1;
+ int ofid = -1;
+ hid_t ifile = H5I_INVALID_HID;
+ hid_t plist = H5I_INVALID_HID;
+ herr_t status;
+ htri_t testval;
+ hsize_t usize;
+ hsize_t h5fsize;
+ hsize_t startub;
+ hsize_t where;
+ hsize_t newubsize;
+ off_t fsize;
+ h5_stat_t sbuf;
+ h5_stat_t sbuf2;
+ int res;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -221,7 +191,7 @@ main (int argc, const char *argv[])
goto done;
}
- testval = H5Fis_hdf5 (ub_file);
+ testval = H5Fis_hdf5(ub_file);
if (testval > 0) {
error_msg("-u <user_file> cannot be HDF5 file, but it appears to be an HDF5 file.\n");
@@ -237,7 +207,7 @@ main (int argc, const char *argv[])
goto done;
}
- testval = H5Fis_hdf5 (input_file);
+ testval = H5Fis_hdf5(input_file);
if (testval <= 0) {
error_msg("Input HDF5 file \"%s\" is not HDF5 format.\n", input_file);
@@ -274,14 +244,14 @@ main (int argc, const char *argv[])
ifile = H5I_INVALID_HID;
ufid = HDopen(ub_file, O_RDONLY);
- if(ufid < 0) {
+ if (ufid < 0) {
error_msg("unable to open user block file \"%s\"\n", ub_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
res = HDfstat(ufid, &sbuf);
- if(res < 0) {
+ if (res < 0) {
error_msg("Can't stat file \"%s\"\n", ub_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -290,14 +260,14 @@ main (int argc, const char *argv[])
fsize = (off_t)sbuf.st_size;
h5fid = HDopen(input_file, O_RDONLY);
- if(h5fid < 0) {
+ if (h5fid < 0) {
error_msg("unable to open HDF5 file for read \"%s\"\n", input_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
res = HDfstat(h5fid, &sbuf2);
- if(res < 0) {
+ if (res < 0) {
error_msg("Can't stat file \"%s\"\n", input_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -324,7 +294,7 @@ main (int argc, const char *argv[])
}
}
- newubsize = compute_user_block_size((hsize_t) fsize);
+ newubsize = compute_user_block_size((hsize_t)fsize);
startub = usize;
@@ -334,53 +304,53 @@ main (int argc, const char *argv[])
if (usize > newubsize) {
newubsize = usize;
}
- startub = 0; /*blast the old */
+ startub = 0; /*blast the old */
}
else {
/* add new ub to current ublock, pad to new offset */
newubsize += usize;
- newubsize = compute_user_block_size((hsize_t) newubsize);
+ newubsize = compute_user_block_size((hsize_t)newubsize);
}
}
/* copy the HDF5 from starting at usize to starting at newubsize:
* makes room at 'from' for new ub */
/* if no current ub, usize is 0 */
- copy_some_to_file(h5fid, ofid, usize, newubsize, (ssize_t) (h5fsize - usize));
+ copy_some_to_file(h5fid, ofid, usize, newubsize, (ssize_t)(h5fsize - usize));
/* copy the old ub to the beginning of the new file */
if (!do_clobber) {
- where = copy_some_to_file(h5fid, ofid, (hsize_t) 0, (hsize_t) 0, (ssize_t) usize);
+ where = copy_some_to_file(h5fid, ofid, (hsize_t)0, (hsize_t)0, (ssize_t)usize);
}
/* copy the new ub to the end of the ub */
- where = copy_some_to_file(ufid, ofid, (hsize_t) 0, startub, (ssize_t) - 1);
+ where = copy_some_to_file(ufid, ofid, (hsize_t)0, startub, (ssize_t)-1);
/* pad the ub */
- if(write_pad(ofid, where, &where) < 0) {
+ if (write_pad(ofid, where, &where) < 0) {
error_msg("Can't pad file \"%s\"\n", output_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
} /* end if */
done:
- if(ub_file)
+ if (ub_file)
HDfree(ub_file);
- if(input_file)
+ if (input_file)
HDfree(input_file);
- if(output_file)
+ if (output_file)
HDfree(output_file);
- if(plist >= 0)
+ if (plist >= 0)
H5Pclose(plist);
- if(ifile >= 0)
+ if (ifile >= 0)
H5Fclose(ifile);
- if(ufid >= 0)
+ if (ufid >= 0)
HDclose(ufid);
- if(h5fid >= 0)
+ if (h5fid >= 0)
HDclose(h5fid);
- if(ofid >= 0)
+ if (ofid >= 0)
HDclose(ofid);
leave(h5tools_getstatus());
@@ -407,29 +377,28 @@ done:
*-------------------------------------------------------------------------
*/
hsize_t
-copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout,
- ssize_t limit)
+copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout, ssize_t limit)
{
- char buf[1024];
+ char buf[1024];
h5_stat_t sbuf;
- int res;
- ssize_t tot = 0;
- ssize_t howmuch = 0;
- ssize_t nchars = -1;
- ssize_t to;
- ssize_t from;
- ssize_t toend;
- ssize_t fromend;
-
- if(startin > startout) {
+ int res;
+ ssize_t tot = 0;
+ ssize_t howmuch = 0;
+ ssize_t nchars = -1;
+ ssize_t to;
+ ssize_t from;
+ ssize_t toend;
+ ssize_t fromend;
+
+ if (startin > startout) {
/* this case is prohibited */
error_msg("copy_some_to_file: panic: startin > startout?\n");
- exit (EXIT_FAILURE);
+ exit(EXIT_FAILURE);
} /* end if */
- if(limit < 0) {
+ if (limit < 0) {
res = HDfstat(infid, &sbuf);
- if(res < 0) {
+ if (res < 0) {
error_msg("Can't stat file \n");
HDexit(EXIT_FAILURE);
} /* end if */
@@ -440,27 +409,27 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout,
howmuch = limit;
} /* end if */
- if(0 == howmuch)
+ if (0 == howmuch)
return 0;
- toend = (ssize_t) startout + howmuch;
- fromend = (ssize_t) startin + howmuch;
+ toend = (ssize_t)startout + howmuch;
+ fromend = (ssize_t)startin + howmuch;
if (howmuch > 512) {
- to = toend - 512;
+ to = toend - 512;
from = fromend - 512;
}
else {
- to = toend - howmuch;
+ to = toend - howmuch;
from = fromend - howmuch;
} /* end if */
while (howmuch > 0) {
- HDlseek(outfid, (off_t) to, SEEK_SET);
- HDlseek(infid, (off_t) from, SEEK_SET);
+ HDlseek(outfid, (off_t)to, SEEK_SET);
+ HDlseek(infid, (off_t)from, SEEK_SET);
if (howmuch > 512) {
- nchars = HDread(infid, buf, (unsigned) 512);
+ nchars = HDread(infid, buf, (unsigned)512);
}
else {
nchars = HDread(infid, buf, (unsigned)howmuch);
@@ -471,14 +440,14 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout,
HDexit(EXIT_FAILURE);
} /* end if */
- if(HDwrite (outfid, buf, (unsigned) nchars) < 0) {
+ if (HDwrite(outfid, buf, (unsigned)nchars) < 0) {
error_msg("Write error \n");
HDexit(EXIT_FAILURE);
}
tot += nchars;
howmuch -= nchars;
- if(howmuch > 512) {
+ if (howmuch > 512) {
to -= nchars;
from -= nchars;
}
@@ -486,12 +455,11 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout,
to -= howmuch;
from -= howmuch;
} /* end if */
- } /* end while */
+ } /* end while */
return (hsize_t)tot + (hsize_t)startout;
} /* end copy_some_to_file() */
-
/*-------------------------------------------------------------------------
* Function: compute_user_block_size
*
@@ -508,10 +476,10 @@ compute_user_block_size(hsize_t ublock_size)
{
hsize_t where = 512;
- if(0 == ublock_size)
+ if (0 == ublock_size)
return 0;
- while(where < ublock_size)
+ while (where < ublock_size)
where *= 2;
return where;
@@ -528,10 +496,10 @@ herr_t
write_pad(int ofile, hsize_t old_where, hsize_t *new_where)
{
unsigned int i;
- char buf[1];
- hsize_t psize;
+ char buf[1];
+ hsize_t psize;
- if(new_where == NULL)
+ if (new_where == NULL)
return FAIL;
buf[0] = '\0';
@@ -541,8 +509,8 @@ write_pad(int ofile, hsize_t old_where, hsize_t *new_where)
psize = compute_user_block_size(old_where);
psize -= old_where;
- for(i = 0; i < psize; i++)
- if(HDwrite(ofile, buf, 1) < 0)
+ for (i = 0; i < psize; i++)
+ if (HDwrite(ofile, buf, 1) < 0)
return FAIL;
/* Set the new size of the file. */
@@ -550,4 +518,3 @@ write_pad(int ofile, hsize_t old_where, hsize_t *new_where)
return SUCCEED;
} /* end write_pad() */
-
diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c
index c6bf498..d0fc5f6 100644
--- a/tools/src/h5jam/h5unjam.c
+++ b/tools/src/h5jam/h5unjam.c
@@ -21,34 +21,28 @@
#define COPY_BUF_SIZE 1024
-hsize_t write_pad( int , hsize_t );
-hsize_t compute_pad( hsize_t );
-herr_t copy_to_file( FILE *, FILE * , ssize_t, ssize_t );
+hsize_t write_pad(int, hsize_t);
+hsize_t compute_pad(hsize_t);
+herr_t copy_to_file(FILE *, FILE *, ssize_t, ssize_t);
-int do_delete = FALSE;
+int do_delete = FALSE;
char *output_file = NULL;
-char *input_file = NULL;
-char *ub_file = NULL;
+char *input_file = NULL;
+char *ub_file = NULL;
/*
* Command-line options: The user can specify short or long-named
* parameters. The long-named ones can be partially spelled. When
* adding more, make sure that they don't clash with each other.
*/
-static const char *s_opts = "hu:i:o:d:V";
+static const char * s_opts = "hu:i:o:d:V";
static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "hel", no_arg, 'h' },
- {"i", require_arg, 'i'}, /* input file */
- {"u", require_arg, 'u'}, /* user block file */
- {"o", require_arg, 'o'}, /* output file */
- {"delete", no_arg, 'd'}, /* delete ub */
- {"delet", no_arg, 'd'},
- {"dele", no_arg, 'd'},
- {"del", no_arg, 'd'},
- {"de", no_arg, 'd'},
- { NULL, 0, '\0' }
-};
+ {"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {"i", require_arg, 'i'}, /* input file */
+ {"u", require_arg, 'u'}, /* user block file */
+ {"o", require_arg, 'o'}, /* output file */
+ {"delete", no_arg, 'd'}, /* delete ub */
+ {"delet", no_arg, 'd'}, {"dele", no_arg, 'd'}, {"del", no_arg, 'd'},
+ {"de", no_arg, 'd'}, {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -62,55 +56,34 @@ static void
usage(const char *prog)
{
HDfflush(stdout);
- HDfprintf(stdout,
- "usage: %s -i <in_file.h5> [-o <out_file.h5> ] [-u <out_user_file> | --delete]\n", prog);
+ HDfprintf(stdout, "usage: %s -i <in_file.h5> [-o <out_file.h5> ] [-u <out_user_file> | --delete]\n",
+ prog);
HDfprintf(stdout, "\n");
- HDfprintf(stdout,
- "Splits user file and HDF5 file into two files: user block data and HDF5 data.\n");
+ HDfprintf(stdout, "Splits user file and HDF5 file into two files: user block data and HDF5 data.\n");
HDfprintf(stdout, "\n");
- HDfprintf(stdout,
- "OPTIONS\n");
- HDfprintf(stdout,
- " -i in_file.h5 Specifies the HDF5 as input. If the input HDF5 file\n");
- HDfprintf(stdout,
- " contains no user block, exit with an error message.\n");
- HDfprintf(stdout,
- " -o out_file.h5 Specifies output HDF5 file without a user block.\n");
- HDfprintf(stdout,
- " If not specified, the user block will be removed from the\n");
- HDfprintf(stdout,
- " input HDF5 file.\n");
- HDfprintf(stdout,
- " -u out_user_file\n");
- HDfprintf(stdout,
- " Specifies the output file containing the data from the\n");
- HDfprintf(stdout,
- " user block.\n");
- HDfprintf(stdout,
- " Cannot be used with --delete option.\n");
- HDfprintf(stdout,
- " --delete Remove the user block from the input HDF5 file. The content\n");
- HDfprintf(stdout,
- " of the user block is discarded.\n");
- HDfprintf(stdout,
- " Cannot be used with the -u option.\n");
+ HDfprintf(stdout, "OPTIONS\n");
+ HDfprintf(stdout, " -i in_file.h5 Specifies the HDF5 as input. If the input HDF5 file\n");
+ HDfprintf(stdout, " contains no user block, exit with an error message.\n");
+ HDfprintf(stdout, " -o out_file.h5 Specifies output HDF5 file without a user block.\n");
+ HDfprintf(stdout, " If not specified, the user block will be removed from the\n");
+ HDfprintf(stdout, " input HDF5 file.\n");
+ HDfprintf(stdout, " -u out_user_file\n");
+ HDfprintf(stdout, " Specifies the output file containing the data from the\n");
+ HDfprintf(stdout, " user block.\n");
+ HDfprintf(stdout, " Cannot be used with --delete option.\n");
+ HDfprintf(stdout, " --delete Remove the user block from the input HDF5 file. The content\n");
+ HDfprintf(stdout, " of the user block is discarded.\n");
+ HDfprintf(stdout, " Cannot be used with the -u option.\n");
HDfprintf(stdout, "\n");
- HDfprintf(stdout,
- " -h Prints a usage message and exits.\n");
- HDfprintf(stdout,
- " -V Prints the HDF5 library version and exits.\n");
+ HDfprintf(stdout, " -h Prints a usage message and exits.\n");
+ HDfprintf(stdout, " -V Prints the HDF5 library version and exits.\n");
HDfprintf(stdout, "\n");
- HDfprintf(stdout,
- " If neither --delete nor -u is specified, the user block from the input file\n");
- HDfprintf(stdout,
- " will be displayed to stdout.\n");
+ HDfprintf(stdout, " If neither --delete nor -u is specified, the user block from the input file\n");
+ HDfprintf(stdout, " will be displayed to stdout.\n");
HDfprintf(stdout, "\n");
- HDfprintf(stdout,
- "Exit Status:\n");
- HDfprintf(stdout,
- " 0 Succeeded.\n");
- HDfprintf(stdout,
- " >0 An error occurred.\n");
+ HDfprintf(stdout, "Exit Status:\n");
+ HDfprintf(stdout, " 0 Succeeded.\n");
+ HDfprintf(stdout, " >0 An error occurred.\n");
}
/*-------------------------------------------------------------------------
@@ -127,9 +100,9 @@ parse_command_line(int argc, const char *argv[])
{
int opt = FALSE;
- /* parse command line options */
+ /* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch((char)opt) {
+ switch ((char)opt) {
case 'o':
output_file = HDstrdup(opt_arg);
if (output_file)
@@ -140,7 +113,8 @@ parse_command_line(int argc, const char *argv[])
input_file = HDstrdup(opt_arg);
if (input_file)
h5tools_set_input_file(input_file, 1);
- break;;
+ break;
+ ;
case 'u':
ub_file = HDstrdup(opt_arg);
@@ -160,7 +134,7 @@ parse_command_line(int argc, const char *argv[])
goto done;
case 'V':
- print_version (h5tools_getprogname());
+ print_version(h5tools_getprogname());
h5tools_setstatus(EXIT_SUCCESS);
goto done;
@@ -175,11 +149,11 @@ parse_command_line(int argc, const char *argv[])
return EXIT_SUCCESS;
done:
- if(input_file)
+ if (input_file)
HDfree(input_file);
- if(output_file)
+ if (output_file)
HDfree(output_file);
- if(ub_file)
+ if (ub_file)
HDfree(ub_file);
return EXIT_FAILURE;
@@ -188,8 +162,8 @@ done:
static void
leave(int ret)
{
- h5tools_close();
- HDexit(ret);
+ h5tools_close();
+ HDexit(ret);
}
/*-------------------------------------------------------------------------
@@ -204,14 +178,14 @@ leave(int ret)
int
main(int argc, const char *argv[])
{
- hid_t ifile = H5I_INVALID_HID;
- hid_t plist = H5I_INVALID_HID;
- off_t fsize;
- hsize_t usize;
- htri_t testval;
- herr_t status;
- int res;
- h5_stat_t sbuf;
+ hid_t ifile = H5I_INVALID_HID;
+ hid_t plist = H5I_INVALID_HID;
+ off_t fsize;
+ hsize_t usize;
+ htri_t testval;
+ herr_t status;
+ int res;
+ h5_stat_t sbuf;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -219,7 +193,7 @@ main(int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
- if(EXIT_FAILURE == parse_command_line(argc, argv))
+ if (EXIT_FAILURE == parse_command_line(argc, argv))
goto done;
/* enable error reporting if command line option */
@@ -237,12 +211,12 @@ main(int argc, const char *argv[])
if (testval <= 0) {
error_msg("Input HDF5 file \"%s\" is not HDF\n", input_file);
- help_ref_msg (stderr);
+ help_ref_msg(stderr);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- ifile = H5Fopen(input_file, H5F_ACC_RDONLY , H5P_DEFAULT);
+ ifile = H5Fopen(input_file, H5F_ACC_RDONLY, H5P_DEFAULT);
if (ifile < 0) {
error_msg("Can't open input HDF5 file \"%s\"\n", input_file);
@@ -257,7 +231,7 @@ main(int argc, const char *argv[])
goto done;
}
- status = H5Pget_userblock(plist, & usize);
+ status = H5Pget_userblock(plist, &usize);
if (status < 0) {
error_msg("Can't get user block for file \"%s\"\n", input_file);
h5tools_setstatus(EXIT_FAILURE);
@@ -268,14 +242,14 @@ main(int argc, const char *argv[])
H5Fclose(ifile);
if (usize == 0) {
- /* no user block to remove: message? */
+ /* no user block to remove: message? */
error_msg("\"%s\" has no user block: no change to file\n", input_file);
h5tools_setstatus(EXIT_SUCCESS);
goto done;
}
res = HDfstat(HDfileno(rawinstream), &sbuf);
- if(res < 0) {
+ if (res < 0) {
error_msg("Can't stat file \"%s\"\n", input_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -290,14 +264,14 @@ main(int argc, const char *argv[])
}
if (output_file == NULL) {
- error_msg("unable to open output HDF5 file \"%s\"\n", input_file);
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
+ error_msg("unable to open output HDF5 file \"%s\"\n", input_file);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
/* copy from 0 to 'usize - 1' into ufid */
if (!do_delete) {
- if(copy_to_file(rawinstream, rawoutstream, 0, (ssize_t) usize) < 0) {
+ if (copy_to_file(rawinstream, rawoutstream, 0, (ssize_t)usize) < 0) {
error_msg("unable to copy user block to output file \"%s\"\n", ub_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -306,20 +280,20 @@ main(int argc, const char *argv[])
/* copy from usize to end of file into h5fid,
* starting at end of user block if present */
- if(copy_to_file(rawinstream, rawdatastream, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) {
+ if (copy_to_file(rawinstream, rawdatastream, (ssize_t)usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) {
error_msg("unable to copy hdf5 data to output file \"%s\"\n", output_file);
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
done:
- if(input_file)
+ if (input_file)
HDfree(input_file);
- if(output_file)
+ if (output_file)
HDfree(output_file);
- if(ub_file) {
+ if (ub_file) {
HDfree(ub_file);
}
@@ -334,17 +308,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
+copy_to_file(FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much)
{
static char buf[COPY_BUF_SIZE];
- size_t how_much;
- off_t where = (off_t)_where;
- off_t to;
- off_t from;
- herr_t ret_value = 0;
+ size_t how_much;
+ off_t where = (off_t)_where;
+ off_t to;
+ off_t from;
+ herr_t ret_value = 0;
/* nothing to copy */
- if(show_much <= 0)
+ if (show_much <= 0)
goto done;
how_much = (size_t)show_much;
@@ -352,27 +326,27 @@ copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
HDfseek(infid, 0L, 0);
from = where;
- to = 0;
- while(how_much > 0) {
- size_t bytes_in = 0; /* # of bytes to read */
- size_t bytes_read = 0; /* # of bytes actually read */
- size_t bytes_wrote = 0; /* # of bytes written */
+ to = 0;
+ while (how_much > 0) {
+ size_t bytes_in = 0; /* # of bytes to read */
+ size_t bytes_read = 0; /* # of bytes actually read */
+ size_t bytes_wrote = 0; /* # of bytes written */
if (how_much > COPY_BUF_SIZE)
bytes_in = COPY_BUF_SIZE;
else
bytes_in = how_much;
- /* Seek to correct position in input file */
+ /* Seek to correct position in input file */
HDfseek(infid, from, SEEK_SET);
/* Read data to buffer */
bytes_read = HDfread(buf, (size_t)1, bytes_in, infid);
- if(0 == bytes_read && HDferror(infid)) {
+ if (0 == bytes_read && HDferror(infid)) {
ret_value = -1;
goto done;
} /* end if */
- if(0 == bytes_read && HDfeof(infid)) {
+ if (0 == bytes_read && HDfeof(infid)) {
goto done;
} /* end if */
@@ -384,15 +358,14 @@ copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
from += (off_t)bytes_read;
to += (off_t)bytes_read;
- /* Write nchars bytes to output file */
+ /* Write nchars bytes to output file */
bytes_wrote = HDfwrite(buf, (size_t)1, bytes_read, ofid);
- if(bytes_wrote != bytes_read || (0 == bytes_wrote && HDferror(ofid))) { /* error */
+ if (bytes_wrote != bytes_read || (0 == bytes_wrote && HDferror(ofid))) { /* error */
ret_value = -1;
goto done;
} /* end if */
- } /* end while */
+ } /* end while */
done:
return ret_value;
-} /* end copy_to_file */
-
+} /* end copy_to_file */
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index c4c3122..a76c1d8 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -16,7 +16,6 @@
* Monday, March 23, 1998
*/
-
/*
* We include the private header file so we can get to the uniform
* programming environment it declares. Other than that, h5ls only calls
@@ -31,111 +30,112 @@
/* Name of tool */
#define PROGRAMNAME "h5ls"
-#define NAME_BUF_SIZE 2048
+#define NAME_BUF_SIZE 2048
/*
* Alternative formating for data dumped by H5LS
*
* This table only affects H5LS output.
*/
-static h5tool_format_t ls_dataformat = {
- 0, /*raw */
-
- "", /*fmt_raw */
- "%d", /*fmt_int */
- "%u", /*fmt_uint */
- "%hhd", /*fmt_schar */
- "%u", /*fmt_uchar */
- "%d", /*fmt_short */
- "%u", /*fmt_ushort */
- "%ld", /*fmt_long */
- "%lu", /*fmt_ulong */
- NULL, /*fmt_llong */
- NULL, /*fmt_ullong */
- "%g", /*fmt_double */
- "%g", /*fmt_float */
-
- 0, /*ascii */
- 0, /*str_locale */
- 0, /*str_repeat */
-
- "[", /*arr_pre */
- ",", /*arr_sep */
- "]", /*arr_suf */
- 1, /*arr_linebreak */
-
- "", /*cmpd_name */
- ",", /*cmpd_sep */
- "{", /*cmpd_pre */
- "}", /*cmpd_suf */
- "", /*cmpd_end */
- NULL, /* cmpd_listv */
-
- ",", /*vlen_sep */
- "(", /*vlen_pre */
- ")", /*vlen_suf */
- "", /*vlen_end */
-
- "%s", /*elmt_fmt */
- ",", /*elmt_suf1 */
- " ", /*elmt_suf2 */
-
- HSIZE_T_FORMAT, /*idx_n_fmt */
- ",", /*idx_sep */
- "(%s)", /*idx_fmt */
-
- 65535, /*line_ncols *//*standard default columns */
- 0, /*line_per_line */
- "", /*line_pre */
- "%s", /*line_1st */
- "%s", /*line_cont */
- "", /*line_suf */
- "", /*line_sep */
- 1, /*line_multi_new */
- " ", /*line_indent */
-
- 0, /*skip_first */
-
- 0, /*obj_hidefileno */
- "-%lu:"H5_PRINTF_HADDR_FMT, /*obj_format */
-
- 0, /*dset_hidefileno */
- "DSET-%s ", /*dset_format */
- "%sBlk%lu: ", /*dset_blockformat_pre */
- "%sPt%lu: ", /*dset_ptformat_pre */
- "%s", /*dset_ptformat */
- 1, /*array indices */
- 1 /*escape non printable characters */
+static h5tool_format_t ls_dataformat = {
+ 0, /*raw */
+
+ "", /*fmt_raw */
+ "%d", /*fmt_int */
+ "%u", /*fmt_uint */
+ "%hhd", /*fmt_schar */
+ "%u", /*fmt_uchar */
+ "%d", /*fmt_short */
+ "%u", /*fmt_ushort */
+ "%ld", /*fmt_long */
+ "%lu", /*fmt_ulong */
+ NULL, /*fmt_llong */
+ NULL, /*fmt_ullong */
+ "%g", /*fmt_double */
+ "%g", /*fmt_float */
+
+ 0, /*ascii */
+ 0, /*str_locale */
+ 0, /*str_repeat */
+
+ "[", /*arr_pre */
+ ",", /*arr_sep */
+ "]", /*arr_suf */
+ 1, /*arr_linebreak */
+
+ "", /*cmpd_name */
+ ",", /*cmpd_sep */
+ "{", /*cmpd_pre */
+ "}", /*cmpd_suf */
+ "", /*cmpd_end */
+ NULL, /* cmpd_listv */
+
+ ",", /*vlen_sep */
+ "(", /*vlen_pre */
+ ")", /*vlen_suf */
+ "", /*vlen_end */
+
+ "%s", /*elmt_fmt */
+ ",", /*elmt_suf1 */
+ " ", /*elmt_suf2 */
+
+ HSIZE_T_FORMAT, /*idx_n_fmt */
+ ",", /*idx_sep */
+ "(%s)", /*idx_fmt */
+
+ 65535,
+ /*line_ncols */ /*standard default columns */
+ 0, /*line_per_line */
+ "", /*line_pre */
+ "%s", /*line_1st */
+ "%s", /*line_cont */
+ "", /*line_suf */
+ "", /*line_sep */
+ 1, /*line_multi_new */
+ " ", /*line_indent */
+
+ 0, /*skip_first */
+
+ 0, /*obj_hidefileno */
+ "-%lu:" H5_PRINTF_HADDR_FMT, /*obj_format */
+
+ 0, /*dset_hidefileno */
+ "DSET-%s ", /*dset_format */
+ "%sBlk%lu: ", /*dset_blockformat_pre */
+ "%sPt%lu: ", /*dset_ptformat_pre */
+ "%s", /*dset_ptformat */
+ 1, /*array indices */
+ 1 /*escape non printable characters */
};
/* Struct to pass through to visitors */
typedef struct {
- const char *fname; /* Filename */
- hid_t fid; /* File ID */
- hid_t gid; /* Group ID */
- hbool_t symlink_target; /* Whether this is the target of an symbolic link */
- symlink_trav_t *symlink_list; /* List of visited symbolic links */
- size_t base_len; /* Length of base path name, if not root */
- size_t name_start; /* # of leading characters to strip off path names on output */
-}iter_t;
+ const char * fname; /* Filename */
+ hid_t fid; /* File ID */
+ hid_t gid; /* Group ID */
+ hbool_t symlink_target; /* Whether this is the target of an symbolic link */
+ symlink_trav_t *symlink_list; /* List of visited symbolic links */
+ size_t base_len; /* Length of base path name, if not root */
+ size_t name_start; /* # of leading characters to strip off path names on output */
+} iter_t;
/* Command-line switches */
-static int verbose_g = 0; /* lots of extra output */
-static int width_g = 80; /* output width in characters */
-static hbool_t address_g = FALSE; /* print raw data addresses */
-static hbool_t data_g = FALSE; /* display dataset values? */
-static hbool_t label_g = FALSE; /* label compound values? */
-static hbool_t string_g = FALSE; /* print 1-byte numbers as ASCII? */
-static hbool_t fullname_g = FALSE; /* print full path names */
-static hbool_t recursive_g = FALSE; /* recursive descent listing */
-static hbool_t follow_symlink_g = FALSE; /* follow symbolic links */
-static hbool_t no_dangling_link_g = FALSE; /* treat dangling link is error */
-static hbool_t follow_elink_g = FALSE; /* follow external links */
-static hbool_t grp_literal_g = FALSE; /* list group, not contents */
-static hbool_t hexdump_g = FALSE; /* show data as raw hexadecimal */
-static hbool_t simple_output_g = FALSE; /* make output more machine-readable */
-static hbool_t show_file_name_g = FALSE; /* show file name for full names */
-static hbool_t no_line_wrap_g = FALSE; /* show data content without line wrap */
-static hbool_t display_root_g = FALSE; /* show root group in output? */
+static int verbose_g = 0; /* lots of extra output */
+static int width_g = 80; /* output width in characters */
+static hbool_t address_g = FALSE; /* print raw data addresses */
+static hbool_t data_g = FALSE; /* display dataset values? */
+static hbool_t label_g = FALSE; /* label compound values? */
+static hbool_t string_g = FALSE; /* print 1-byte numbers as ASCII? */
+static hbool_t fullname_g = FALSE; /* print full path names */
+static hbool_t recursive_g = FALSE; /* recursive descent listing */
+static hbool_t follow_symlink_g = FALSE; /* follow symbolic links */
+static hbool_t no_dangling_link_g = FALSE; /* treat dangling link is error */
+static hbool_t follow_elink_g = FALSE; /* follow external links */
+static hbool_t grp_literal_g = FALSE; /* list group, not contents */
+static hbool_t hexdump_g = FALSE; /* show data as raw hexadecimal */
+static hbool_t simple_output_g = FALSE; /* make output more machine-readable */
+static hbool_t show_file_name_g = FALSE; /* show file name for full names */
+static hbool_t no_line_wrap_g = FALSE; /* show data content without line wrap */
+static hbool_t display_root_g = FALSE; /* show root group in output? */
/* Information about how to display each type of object */
static struct dispatch_t {
@@ -146,17 +146,17 @@ static struct dispatch_t {
herr_t (*list2)(hid_t obj, const char *name);
} dispatch_g[H5O_TYPE_NTYPES];
-#define DISPATCH(TYPE, NAME, LIST1, LIST2) { \
- dispatch_g[TYPE].name = (NAME); \
- dispatch_g[TYPE].list1 = (LIST1); \
- dispatch_g[TYPE].list2 = (LIST2); \
-}
+#define DISPATCH(TYPE, NAME, LIST1, LIST2) \
+ { \
+ dispatch_g[TYPE].name = (NAME); \
+ dispatch_g[TYPE].list1 = (LIST1); \
+ dispatch_g[TYPE].list2 = (LIST2); \
+ }
-static void print_type(h5tools_str_t *buffer, hid_t type, int ind);
+static void print_type(h5tools_str_t *buffer, hid_t type, int ind);
static hbool_t print_int_type(h5tools_str_t *buffer, hid_t type, int ind);
static hbool_t print_float_type(h5tools_str_t *buffer, hid_t type, int ind);
-static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
-
+static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
/*-------------------------------------------------------------------------
* Function: usage
@@ -167,36 +167,46 @@ static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
*-------------------------------------------------------------------------
*/
static void
-usage (void)
+usage(void)
{
FLUSHSTREAM(rawoutstream);
PRINTVALSTREAM(rawoutstream, "usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n");
PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -h, -?, --help Print a usage message and exit\n");
- PRINTVALSTREAM(rawoutstream, " -a, --address Print raw data address. If dataset is contiguous, address\n");
- PRINTVALSTREAM(rawoutstream, " is offset in file of beginning of raw data. If chunked,\n");
- PRINTVALSTREAM(rawoutstream, " returned list of addresses indicates offset of each chunk.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -a, --address Print raw data address. If dataset is contiguous, address\n");
+ PRINTVALSTREAM(rawoutstream,
+ " is offset in file of beginning of raw data. If chunked,\n");
+ PRINTVALSTREAM(rawoutstream,
+ " returned list of addresses indicates offset of each chunk.\n");
PRINTVALSTREAM(rawoutstream, " Must be used with -v, --verbose option.\n");
PRINTVALSTREAM(rawoutstream, " Provides no information for non-dataset objects.\n");
PRINTVALSTREAM(rawoutstream, " -d, --data Print the values of datasets\n");
PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
- PRINTVALSTREAM(rawoutstream, " Prints messages from the HDF5 error stack as they occur.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Prints messages from the HDF5 error stack as they occur.\n");
PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n");
- PRINTVALSTREAM(rawoutstream, " Follow symbolic links (soft links and external links)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Follow symbolic links (soft links and external links)\n");
PRINTVALSTREAM(rawoutstream, " to display target object information.\n");
PRINTVALSTREAM(rawoutstream, " Without this option, h5ls identifies a symbolic link\n");
PRINTVALSTREAM(rawoutstream, " as a soft link or external link and prints the value\n");
- PRINTVALSTREAM(rawoutstream, " assigned to the symbolic link; it does not provide any\n");
+ PRINTVALSTREAM(rawoutstream,
+ " assigned to the symbolic link; it does not provide any\n");
PRINTVALSTREAM(rawoutstream, " information regarding the target object or determine\n");
PRINTVALSTREAM(rawoutstream, " whether the link is a dangling link.\n");
PRINTVALSTREAM(rawoutstream, " --no-dangling-links\n");
PRINTVALSTREAM(rawoutstream, " Must be used with --follow-symlinks option;\n");
- PRINTVALSTREAM(rawoutstream, " otherwise, h5ls shows error message and returns an exit\n");
+ PRINTVALSTREAM(rawoutstream,
+ " otherwise, h5ls shows error message and returns an exit\n");
PRINTVALSTREAM(rawoutstream, " code of 1.\n");
- PRINTVALSTREAM(rawoutstream, " Check for any symbolic links (soft links or external links)\n");
- PRINTVALSTREAM(rawoutstream, " that do not resolve to an existing object (dataset, group,\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Check for any symbolic links (soft links or external links)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " that do not resolve to an existing object (dataset, group,\n");
PRINTVALSTREAM(rawoutstream, " or named datatype).\n");
- PRINTVALSTREAM(rawoutstream, " If any dangling link is found, this situation is treated\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If any dangling link is found, this situation is treated\n");
PRINTVALSTREAM(rawoutstream, " as an error and h5ls returns an exit code of 1.\n");
PRINTVALSTREAM(rawoutstream, " -f, --full Print full path names instead of base names\n");
PRINTVALSTREAM(rawoutstream, " -g, --group Show information about a group, not its contents\n");
@@ -209,14 +219,18 @@ usage (void)
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " --vfd=DRIVER Use the specified virtual file driver\n");
PRINTVALSTREAM(rawoutstream, " -x, --hexdump Show raw data in hexadecimal format\n");
- PRINTVALSTREAM(rawoutstream, " --s3-cred=C Supply S3 authentication information to \"ros3\" vfd.\n");
- PRINTVALSTREAM(rawoutstream, " Accepts tuple of \"(<aws-region>,<access-id>,<access-key>)\".\n");
- PRINTVALSTREAM(rawoutstream, " If absent or C->\"(,,)\", defaults to no-authentication.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --s3-cred=C Supply S3 authentication information to \"ros3\" vfd.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Accepts tuple of \"(<aws-region>,<access-id>,<access-key>)\".\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If absent or C->\"(,,)\", defaults to no-authentication.\n");
PRINTVALSTREAM(rawoutstream, " Has no effect if vfd flag not set to \"ros3\".\n");
PRINTVALSTREAM(rawoutstream, " --hdfs-attrs=A Supply configuration information to Hadoop VFD.\n");
PRINTVALSTREAM(rawoutstream, " Accepts tuple of (<namenode name>,<namenode port>,\n");
PRINTVALSTREAM(rawoutstream, " ...<kerberos cache path>,<username>,<buffer size>)\n");
- PRINTVALSTREAM(rawoutstream, " If absent or A == '(,,,,)', all default values are used.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " If absent or A == '(,,,,)', all default values are used.\n");
PRINTVALSTREAM(rawoutstream, " Has no effect if vfd flag is not 'hdfs'.\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " file/OBJECT\n");
@@ -227,10 +241,14 @@ usage (void)
PRINTVALSTREAM(rawoutstream, " \"%%05d\" to open a file family.\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " Deprecated Options\n");
- PRINTVALSTREAM(rawoutstream, " The following options have been deprecated in HDF5. While they remain\n");
- PRINTVALSTREAM(rawoutstream, " available, they have been superseded as indicated and may be removed\n");
- PRINTVALSTREAM(rawoutstream, " from HDF5 in the future. Use the indicated replacement option in all\n");
- PRINTVALSTREAM(rawoutstream, " new work; where possible, existing scripts, et cetera, should also be\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The following options have been deprecated in HDF5. While they remain\n");
+ PRINTVALSTREAM(rawoutstream,
+ " available, they have been superseded as indicated and may be removed\n");
+ PRINTVALSTREAM(rawoutstream,
+ " from HDF5 in the future. Use the indicated replacement option in all\n");
+ PRINTVALSTREAM(rawoutstream,
+ " new work; where possible, existing scripts, et cetera, should also be\n");
PRINTVALSTREAM(rawoutstream, " updated to use the replacement option.\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " -E or --external Follow external links.\n");
@@ -239,7 +257,6 @@ usage (void)
PRINTVALSTREAM(rawoutstream, " Replaced by --enable-error-stack.\n");
}
-
/*-------------------------------------------------------------------------
* Function: print_string
*
@@ -252,7 +269,7 @@ usage (void)
static int
print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces)
{
- int nprint=0;
+ int nprint = 0;
for (/*void*/; s && *s; s++) {
switch (*s) {
@@ -311,7 +328,7 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces)
}
else {
if (buffer)
- h5tools_str_append(buffer, "\\%03o", *((const unsigned char*)s));
+ h5tools_str_append(buffer, "\\%03o", *((const unsigned char *)s));
nprint += 4;
}
break;
@@ -320,7 +337,6 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces)
return nprint;
}
-
/*-------------------------------------------------------------------------
* Function: print_obj_name
*
@@ -333,9 +349,9 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces)
static int
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 */
- int n;
+ static char fullname[NAME_BUF_SIZE]; /* Buffer for file and/or object name */
+ const char *name = fullname; /* Pointer to buffer for printing */
+ int n;
if (show_file_name_g)
HDsnprintf(fullname, sizeof(fullname), "%s/%s", iter->fname, oname + iter->name_start);
@@ -346,7 +362,7 @@ print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, con
if (fullname_g)
n = print_string(buffer, name, TRUE);
else {
- const char *last_sep; /* The location of the last group separator */
+ const char *last_sep; /* The location of the last group separator */
/* Find the last component of the path name */
if (NULL == (last_sep = HDstrrchr(name, '/')))
@@ -361,7 +377,6 @@ print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, con
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_native_type
*
@@ -411,7 +426,7 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind)
else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) {
h5tools_str_append(buffer, "native double");
}
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) {
h5tools_str_append(buffer, "native long double");
}
@@ -522,7 +537,6 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind)
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_ieee_type
*
@@ -553,7 +567,6 @@ print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind)
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_precision
*
@@ -567,22 +580,22 @@ print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind)
static void
print_precision(h5tools_str_t *buffer, hid_t type, int ind)
{
- size_t prec; /* precision */
- H5T_pad_t plsb, pmsb; /* lsb and msb padding */
- const char *plsb_s=NULL; /* lsb padding string */
- const char *pmsb_s=NULL; /* msb padding string */
- size_t nbits; /* number of bits */
+ size_t prec; /* precision */
+ H5T_pad_t plsb, pmsb; /* lsb and msb padding */
+ const char *plsb_s = NULL; /* lsb padding string */
+ const char *pmsb_s = NULL; /* msb padding string */
+ size_t nbits; /* number of bits */
/* If the precision is less than the total size then show the precision
* and offset on the following line. Also display the padding
* information. */
if (8 * H5Tget_size(type) != (prec = H5Tget_precision(type))) {
- h5tools_str_append(buffer, "\n%*s(%lu bit%s of precision beginning at bit %lu)",
- ind, "", (unsigned long)prec, 1 == prec ? "" : "s", (unsigned long)H5Tget_offset(type));
+ h5tools_str_append(buffer, "\n%*s(%lu bit%s of precision beginning at bit %lu)", ind, "",
+ (unsigned long)prec, 1 == prec ? "" : "s", (unsigned long)H5Tget_offset(type));
H5Tget_pad(type, &plsb, &pmsb);
if (H5Tget_offset(type) > 0) {
- switch(plsb) {
+ switch (plsb) {
case H5T_PAD_ZERO:
plsb_s = "zero";
break;
@@ -601,7 +614,7 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
}
}
if ((unsigned)H5Tget_offset(type) + prec < 8 * H5Tget_size(type)) {
- switch(pmsb) {
+ switch (pmsb) {
case H5T_PAD_ZERO:
pmsb_s = "zero";
break;
@@ -623,20 +636,21 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
h5tools_str_append(buffer, "\n%*s(", ind, "");
if (plsb_s) {
nbits = (unsigned)H5Tget_offset(type);
- h5tools_str_append(buffer, "%lu %s bit%s at bit 0", (unsigned long)nbits, plsb_s, 1 == nbits ? "" : "s");
+ h5tools_str_append(buffer, "%lu %s bit%s at bit 0", (unsigned long)nbits, plsb_s,
+ 1 == nbits ? "" : "s");
}
if (plsb_s && pmsb_s)
h5tools_str_append(buffer, ", ");
if (pmsb_s) {
nbits = (8 * H5Tget_size(type)) - ((unsigned)H5Tget_offset(type) + prec);
- h5tools_str_append(buffer, "%lu %s bit%s at bit %lu", (unsigned long)nbits, pmsb_s, 1 == nbits ? "" : "s", (unsigned long)(8 * H5Tget_size(type) - nbits));
+ h5tools_str_append(buffer, "%lu %s bit%s at bit %lu", (unsigned long)nbits, pmsb_s,
+ 1 == nbits ? "" : "s", (unsigned long)(8 * H5Tget_size(type) - nbits));
}
h5tools_str_append(buffer, ")");
}
}
}
-
/*-------------------------------------------------------------------------
* Function: print_int_type
*
@@ -652,10 +666,10 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_int_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_sign_t sign; /* sign scheme value */
- const char *sign_s = NULL; /* sign scheme string */
+ H5T_order_t order; /* byte order value */
+ const char *order_s = NULL; /* byte order string */
+ H5T_sign_t sign; /* sign scheme value */
+ const char *sign_s = NULL; /* sign scheme string */
if (H5T_INTEGER != H5Tget_class(type))
return FALSE;
@@ -698,12 +712,12 @@ print_int_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print size, order, and sign on first line, precision and padding
* information on the subsequent lines */
- h5tools_str_append(buffer, "%lu-bit%s%s integer", (unsigned long)(8*H5Tget_size(type)), order_s, sign_s);
+ h5tools_str_append(buffer, "%lu-bit%s%s integer", (unsigned long)(8 * H5Tget_size(type)), order_s,
+ sign_s);
print_precision(buffer, type, ind);
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_float_type
*
@@ -717,15 +731,15 @@ static hbool_t
print_float_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 */
+ const char *order_s = NULL; /* byte order string */
size_t spos; /* sign bit position */
size_t esize, epos; /* exponent size and position */
size_t msize, mpos; /* significand size and position */
size_t ebias; /* exponent bias */
H5T_norm_t norm; /* significand normalization */
- const char *norm_s=NULL; /* normalization string */
+ const char *norm_s = NULL; /* normalization string */
H5T_pad_t pad; /* internal padding value */
- const char *pad_s=NULL; /* internal padding string */
+ const char *pad_s = NULL; /* internal padding string */
if (H5T_FLOAT != H5Tget_class(type))
return FALSE;
@@ -752,13 +766,13 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print size and byte order on first line, precision and padding on
* subsequent lines. */
- h5tools_str_append(buffer, "%lu-bit%s floating-point", (unsigned long)(8*H5Tget_size(type)), order_s);
+ h5tools_str_append(buffer, "%lu-bit%s floating-point", (unsigned long)(8 * H5Tget_size(type)), order_s);
print_precision(buffer, type, ind);
/* Print sizes, locations, and other information about each field */
- H5Tget_fields (type, &spos, &epos, &esize, &mpos, &msize);
+ H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize);
ebias = H5Tget_ebias(type);
- norm = H5Tget_norm(type);
+ norm = H5Tget_norm(type);
switch (norm) {
case H5T_NORM_IMPLIED:
norm_s = ", msb implied";
@@ -772,14 +786,14 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
case H5T_NORM_ERROR:
norm_s = ", unknown normalization";
break;
- default:
- ;
- break;
+ default:;
+ break;
}
- h5tools_str_append(buffer, "\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "",
- (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, norm_s);
- h5tools_str_append(buffer, "\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)",
- ind, "", (unsigned long)esize, 1==esize?"":"s", (unsigned long)epos, (unsigned long)ebias);
+ h5tools_str_append(buffer, "\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "", (unsigned long)msize,
+ 1 == msize ? "" : "s", (unsigned long)mpos, norm_s);
+ h5tools_str_append(buffer, "\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)", ind, "",
+ (unsigned long)esize, 1 == esize ? "" : "s", (unsigned long)epos,
+ (unsigned long)ebias);
h5tools_str_append(buffer, "\n%*s(sign bit at %lu)", ind, "", (unsigned long)spos);
/* Display internal padding */
@@ -799,16 +813,14 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
case H5T_NPAD:
pad_s = "unknown";
break;
- default:
- ;
- break;
+ default:;
+ break;
}
h5tools_str_append(buffer, "\n%*s(internal padding bits are %s)", ind, "", pad_s);
}
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_cmpd_type
*
@@ -821,39 +833,39 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- 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 */
- int n; /* miscellaneous counters */
- unsigned i; /* miscellaneous counters */
-
- if(H5T_COMPOUND != H5Tget_class(type))
+ 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 */
+ int n; /* miscellaneous counters */
+ unsigned i; /* miscellaneous counters */
+
+ if (H5T_COMPOUND != H5Tget_class(type))
return FALSE;
- if((nmembs = H5Tget_nmembers(type)) < 0)
+ if ((nmembs = H5Tget_nmembers(type)) < 0)
return FALSE;
h5tools_str_append(buffer, "struct {");
for (i = 0; i < (unsigned)nmembs; i++) {
/* Name and offset */
name = H5Tget_member_name(type, i);
- h5tools_str_append(buffer, "\n%*s\"", ind+4, "");
+ h5tools_str_append(buffer, "\n%*s\"", ind + 4, "");
n = print_string(buffer, name, FALSE);
- h5tools_str_append(buffer, "\"%*s +%-4lu ", MAX(0, 16-n), "", (unsigned long)H5Tget_member_offset(type, i));
+ h5tools_str_append(buffer, "\"%*s +%-4lu ", MAX(0, 16 - n), "",
+ (unsigned long)H5Tget_member_offset(type, i));
H5free_memory(name);
/* Member's type */
subtype = H5Tget_member_type(type, i);
- print_type(buffer, subtype, ind+4);
+ print_type(buffer, subtype, ind + 4);
H5Tclose(subtype);
}
size = H5Tget_size(type);
- h5tools_str_append(buffer, "\n%*s} %lu byte%s", ind, "", (unsigned long)size, 1==size?"":"s");
+ h5tools_str_append(buffer, "\n%*s} %lu byte%s", ind, "", (unsigned long)size, 1 == size ? "" : "s");
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_enum_type
*
@@ -866,8 +878,8 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- int nmembs; /* number of members */
- hid_t super; /* enum base integer type */
+ int nmembs; /* number of members */
+ hid_t super; /* enum base integer type */
if (H5T_ENUM != H5Tget_class(type))
return FALSE;
@@ -880,11 +892,11 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
h5tools_str_append(buffer, " {");
if (nmembs > 0) {
- char **name; /* member names */
- unsigned char *value; /* value array */
- hid_t native = H5I_INVALID_HID; /* native integer data type */
- size_t dst_size; /* destination value type size */
- unsigned i; /* miscellaneous counters */
+ char ** name; /* member names */
+ unsigned char *value; /* value array */
+ hid_t native = H5I_INVALID_HID; /* native integer data type */
+ size_t dst_size; /* destination value type size */
+ unsigned i; /* miscellaneous counters */
/* Determine what data type to use for the native values. To simplify
* things we entertain three possibilities:
@@ -902,7 +914,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
dst_size = H5Tget_size(type);
/* Get the names and raw values of all members */
- name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
+ name = (char **)HDcalloc((size_t)nmembs, sizeof(char *));
value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size));
for (i = 0; i < (unsigned)nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
@@ -927,10 +939,10 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print members */
for (i = 0; i < (unsigned)nmembs; i++) {
- unsigned char *copy; /* a pointer to value array */
- int nchars; /* number of output characters */
+ unsigned char *copy; /* a pointer to value array */
+ int nchars; /* number of output characters */
- h5tools_str_append(buffer, "\n%*s", ind+4, "");
+ h5tools_str_append(buffer, "\n%*s", ind + 4, "");
nchars = print_string(buffer, name[i], TRUE);
h5tools_str_append(buffer, "%*s = ", MAX(0, 16 - nchars), "");
@@ -939,30 +951,30 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
h5tools_str_append(buffer, "0x");
for (j = 0; j < dst_size; j++)
- h5tools_str_append(buffer, "%02x", value[i*dst_size+j]);
+ h5tools_str_append(buffer, "%02x", value[i * dst_size + j]);
}
else if (H5T_SGN_NONE == H5Tget_sign(native)) {
/*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
*strangely, unless use another pointer "copy".*/
copy = value + i * dst_size;
- h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long*)((void*)copy)));
+ h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long *)((void *)copy)));
}
else {
/*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
*strangely, unless use another pointer "copy".*/
copy = value + i * dst_size;
- h5tools_str_append(buffer, "%"H5_PRINTF_LL_WIDTH"d", *((long long*)((void*)copy)));
+ h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "d", *((long long *)((void *)copy)));
}
}
/* Release resources */
- for(i = 0; i < (unsigned)nmembs; i++)
+ for (i = 0; i < (unsigned)nmembs; i++)
H5free_memory(name[i]);
HDfree(name);
HDfree(value);
}
else
- h5tools_str_append(buffer, "\n%*s <empty>", ind+4, "");
+ h5tools_str_append(buffer, "\n%*s <empty>", ind + 4, "");
h5tools_str_append(buffer, "\n%*s}", ind, "");
@@ -971,7 +983,6 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_string_type
*
@@ -984,10 +995,10 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
{
- H5T_str_t pad;
- const char *pad_s=NULL;
+ H5T_str_t pad;
+ const char *pad_s = NULL;
H5T_cset_t cset;
- const char *cset_s=NULL;
+ const char *cset_s = NULL;
if (H5T_STRING != H5Tget_class(type))
return FALSE;
@@ -1020,9 +1031,8 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
case H5T_STR_ERROR:
pad_s = "unknown-format";
break;
- default:
- ;
- break;
+ default:;
+ break;
}
/* Character set */
@@ -1051,9 +1061,8 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
case H5T_CSET_ERROR:
cset_s = "unknown-character-set";
break;
- default:
- ;
- break;
+ default:;
+ break;
}
if (H5Tis_variable_str(type)) {
@@ -1066,7 +1075,6 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_reference_type
*
@@ -1095,7 +1103,6 @@ print_reference_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_opaque_type
*
@@ -1108,7 +1115,7 @@ print_reference_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind)
static hbool_t
print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- char *tag;
+ char * tag;
size_t size;
if (H5T_OPAQUE != H5Tget_class(type))
@@ -1125,7 +1132,6 @@ print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind)
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_vlen_type
*
@@ -1138,7 +1144,7 @@ print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- hid_t super;
+ hid_t super;
if (H5T_VLEN != H5Tget_class(type))
return FALSE;
@@ -1150,7 +1156,6 @@ print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind)
return TRUE;
}
-
/*---------------------------------------------------------------------------
* Purpose: Print information about an array type
*
@@ -1161,9 +1166,9 @@ print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind)
static hbool_t
print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- hid_t super;
- int ndims, i;
- hsize_t *dims=NULL;
+ hid_t super;
+ int ndims, i;
+ hsize_t *dims = NULL;
if (H5T_ARRAY != H5Tget_class(type))
return FALSE;
@@ -1174,7 +1179,7 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print dimensions */
for (i = 0; i < ndims; i++)
- h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT , i?",":"[", dims[i]);
+ h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, i ? "," : "[", dims[i]);
h5tools_str_append(buffer, "]");
HDfree(dims);
@@ -1182,16 +1187,14 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
else
h5tools_str_append(buffer, " [SCALAR]\n", rawoutstream);
-
/* Print parent type */
h5tools_str_append(buffer, " ");
super = H5Tget_super(type);
- print_type(buffer, super, ind+4);
+ print_type(buffer, super, ind + 4);
H5Tclose(super);
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_bitfield_type
*
@@ -1204,12 +1207,12 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
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;
- if (H5Tget_size(type)>1) {
+ if (H5Tget_size(type) > 1) {
order = H5Tget_order(type);
if (H5T_ORDER_LE == order) {
order_s = " little-endian";
@@ -1228,12 +1231,11 @@ print_bitfield_type(h5tools_str_t *buffer, hid_t type, int ind)
order_s = "";
}
- h5tools_str_append(buffer, "%lu-bit%s bitfield", (unsigned long)(8*H5Tget_size(type)), order_s);
+ h5tools_str_append(buffer, "%lu-bit%s bitfield", (unsigned long)(8 * H5Tget_size(type)), order_s);
print_precision(buffer, type, ind);
return TRUE;
}
-
/*-------------------------------------------------------------------------
* Function: print_type
*
@@ -1250,39 +1252,35 @@ print_bitfield_type(h5tools_str_t *buffer, hid_t type, int ind)
static void
print_type(h5tools_str_t *buffer, hid_t type, int ind)
{
- H5T_class_t data_class = H5Tget_class(type);
+ H5T_class_t data_class = H5Tget_class(type);
/* Bad data type */
if (type < 0) {
- h5tools_str_append(buffer,"<ERROR>");
+ h5tools_str_append(buffer, "<ERROR>");
return;
}
/* Shared? If so then print the type's OID */
if (H5Tcommitted(type)) {
- H5O_info_t oi;
+ H5O_info_t oi;
if (H5Oget_info2(type, &oi, H5O_INFO_BASIC) >= 0)
- h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr);
+ h5tools_str_append(buffer, "shared-%lu:" H5_PRINTF_HADDR_FMT " ", oi.fileno, oi.addr);
else
- h5tools_str_append(buffer,"shared ");
+ h5tools_str_append(buffer, "shared ");
} /* end if */
/* Print the type */
- if (print_native_type(buffer, type, ind) ||
- print_ieee_type(buffer, type, ind) ||
- print_cmpd_type(buffer, type, ind) ||
- print_enum_type(buffer, type, ind) ||
- print_string_type(buffer, type, ind) ||
- print_reference_type(buffer, type, ind) ||
- print_vlen_type(buffer, type, ind) ||
- print_array_type(buffer, type, ind) ||
- print_opaque_type(buffer, type, ind) ||
- print_bitfield_type(buffer, type, ind))
+ if (print_native_type(buffer, type, ind) || print_ieee_type(buffer, type, ind) ||
+ print_cmpd_type(buffer, type, ind) || print_enum_type(buffer, type, ind) ||
+ print_string_type(buffer, type, ind) || print_reference_type(buffer, type, ind) ||
+ print_vlen_type(buffer, type, ind) || print_array_type(buffer, type, ind) ||
+ print_opaque_type(buffer, type, ind) || print_bitfield_type(buffer, type, ind))
return;
/* Unknown type */
- h5tools_str_append(buffer,"%lu-byte class-%u unknown", (unsigned long)H5Tget_size(type), (unsigned)data_class);
+ h5tools_str_append(buffer, "%lu-byte class-%u unknown", (unsigned long)H5Tget_size(type),
+ (unsigned)data_class);
}
/*-------------------------------------------------------------------------
@@ -1296,39 +1294,39 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind)
static void
dump_dataset_values(hid_t dset)
{
- hid_t f_type = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hsize_t total_size[H5S_MAX_RANK];
- int ndims;
- size_t nsize;
- char string_prefix[64];
- static char fmt_double[16];
- static char fmt_float[16];
- 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;
- h5tool_format_t *info = &ls_dataformat;
- unsigned char *region_buf = NULL;
+ hid_t f_type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hsize_t total_size[H5S_MAX_RANK];
+ int ndims;
+ size_t nsize;
+ char string_prefix[64];
+ static char fmt_double[16];
+ static char fmt_float[16];
+ 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;
+ h5tool_format_t * info = &ls_dataformat;
+ unsigned char * region_buf = NULL;
H5TOOLS_START_DEBUG("");
f_type = H5Dget_type(dset);
- space = H5Dget_space(dset);
- nsize = H5Tget_size(f_type);
+ space = H5Dget_space(dset);
+ nsize = H5Tget_size(f_type);
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
- outputformat = *info;
- outputformat.line_1st = NULL;
- outputformat.idx_fmt = "";
+ outputformat = *info;
+ outputformat.line_1st = NULL;
+ outputformat.idx_fmt = "";
if (simple_output_g) {
- outputformat.idx_fmt = "";
- outputformat.line_per_line = 1;
+ outputformat.idx_fmt = "";
+ outputformat.line_per_line = 1;
outputformat.line_multi_new = 0;
- outputformat.line_pre = " ";
- outputformat.line_cont = " ";
+ outputformat.line_pre = " ";
+ outputformat.line_cont = " ";
outputformat.arr_pre = "";
outputformat.arr_suf = "";
@@ -1343,9 +1341,8 @@ dump_dataset_values(hid_t dset)
if (label_g)
outputformat.cmpd_name = "%s=";
- outputformat.elmt_suf1 = " ";
+ outputformat.elmt_suf1 = " ";
outputformat.str_locale = ESCAPE_HTML;
-
}
else {
if (no_line_wrap_g) {
@@ -1356,8 +1353,8 @@ dump_dataset_values(hid_t dset)
}
if (label_g)
outputformat.cmpd_name = "%s=";
- outputformat.line_pre = " %s ";
- outputformat.line_cont = " %s ";
+ outputformat.line_pre = " %s ";
+ outputformat.line_cont = " %s ";
outputformat.str_repeat = 8;
outputformat.arr_pre = NULL;
@@ -1388,7 +1385,7 @@ dump_dataset_values(hid_t dset)
else if (string_g && H5Tget_size(f_type) == 1 && (H5Tget_class(f_type) == H5T_INTEGER)) {
/* Print 1-byte integer data as an ASCI character string instead of
* integers if the `-s' or `--string' command-line option was given. */
- outputformat.ascii = TRUE;
+ outputformat.ascii = TRUE;
outputformat.elmt_suf1 = "";
outputformat.elmt_suf2 = "";
HDsnprintf(string_prefix, sizeof(string_prefix), "%s\"", outputformat.line_pre);
@@ -1398,15 +1395,16 @@ dump_dataset_values(hid_t dset)
info = &outputformat;
ctx.indent_level = 1;
- ctx.cur_column = (size_t)curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
/* Print all the values. */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Data:\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0,
+ (hsize_t)0);
ctx.need_prefix = TRUE;
- ctx.cur_column = (size_t)curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
if (H5Tget_class(f_type) == H5T_REFERENCE) {
H5TOOLS_DEBUG("reference class type");
if (!H5Tequal(f_type, H5T_STD_REF_DSETREG) && !H5Tequal(f_type, H5T_STD_REF_OBJ)) {
@@ -1439,7 +1437,8 @@ dump_dataset_values(hid_t dset)
if (h5tools_dump_dset(rawoutstream, info, &ctx, dset) < 0) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Unable to print data.");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
}
}
done:
@@ -1453,7 +1452,6 @@ done:
H5TOOLS_ENDDEBUG("");
}
-
/*-------------------------------------------------------------------------
* Function: dump_attribute_values
*
@@ -1465,39 +1463,39 @@ done:
static void
dump_attribute_values(hid_t attr)
{
- hid_t f_type = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hsize_t total_size[H5S_MAX_RANK];
- int ndims;
- size_t nsize;
- char string_prefix[64];
- static char fmt_double[16];
- static char fmt_float[16];
- 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;
- h5tool_format_t *info = &ls_dataformat;
- unsigned char *region_buf = NULL;
+ hid_t f_type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hsize_t total_size[H5S_MAX_RANK];
+ int ndims;
+ size_t nsize;
+ char string_prefix[64];
+ static char fmt_double[16];
+ static char fmt_float[16];
+ 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;
+ h5tool_format_t * info = &ls_dataformat;
+ unsigned char * region_buf = NULL;
H5TOOLS_START_DEBUG("");
f_type = H5Aget_type(attr);
- space = H5Aget_space(attr);
- nsize = H5Tget_size(f_type);
+ space = H5Aget_space(attr);
+ nsize = H5Tget_size(f_type);
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
- outputformat = *info;
- outputformat.line_1st = NULL;
- outputformat.idx_fmt = "";
+ outputformat = *info;
+ outputformat.line_1st = NULL;
+ outputformat.idx_fmt = "";
if (simple_output_g) {
- outputformat.idx_fmt = "";
- outputformat.line_per_line = 1;
+ outputformat.idx_fmt = "";
+ outputformat.line_per_line = 1;
outputformat.line_multi_new = 0;
- outputformat.line_pre = " ";
- outputformat.line_cont = " ";
+ outputformat.line_pre = " ";
+ outputformat.line_cont = " ";
outputformat.arr_pre = "";
outputformat.arr_suf = "";
@@ -1512,9 +1510,8 @@ dump_attribute_values(hid_t attr)
if (label_g)
outputformat.cmpd_name = "%s=";
- outputformat.elmt_suf1 = " ";
+ outputformat.elmt_suf1 = " ";
outputformat.str_locale = ESCAPE_HTML;
-
}
else {
if (no_line_wrap_g) {
@@ -1525,8 +1522,8 @@ dump_attribute_values(hid_t attr)
}
if (label_g)
outputformat.cmpd_name = "%s=";
- outputformat.line_pre = " %s ";
- outputformat.line_cont = " %s ";
+ outputformat.line_pre = " %s ";
+ outputformat.line_cont = " %s ";
outputformat.str_repeat = 8;
outputformat.arr_pre = NULL;
@@ -1557,7 +1554,7 @@ dump_attribute_values(hid_t attr)
else if (string_g && H5Tget_size(f_type) == 1 && (H5Tget_class(f_type) == H5T_INTEGER)) {
/* Print 1-byte integer data as an ASCI character string instead of
* integers if the `-s' or `--string' command-line option was given. */
- outputformat.ascii = TRUE;
+ outputformat.ascii = TRUE;
outputformat.elmt_suf1 = "";
outputformat.elmt_suf2 = "";
HDsnprintf(string_prefix, sizeof(string_prefix), "%s\"", outputformat.line_pre);
@@ -1567,16 +1564,17 @@ dump_attribute_values(hid_t attr)
info = &outputformat;
ctx.indent_level = 2;
- ctx.cur_column = (size_t)curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
/* Print all the values. */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Data:\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0,
+ (hsize_t)0);
ctx.need_prefix = TRUE;
- ctx.cur_column = (size_t)curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
if (H5Tget_class(f_type) == H5T_REFERENCE) {
H5TOOLS_DEBUG("reference class type");
if (!H5Tequal(f_type, H5T_STD_REF_DSETREG) && !H5Tequal(f_type, H5T_STD_REF_OBJ)) {
@@ -1613,7 +1611,8 @@ dump_attribute_values(hid_t attr)
if (h5tools_dump_mem(rawoutstream, info, &ctx, attr) < 0) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Unable to print data.");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
}
ctx.indent_level--;
H5TOOLS_DEBUG("Attribute data read complete");
@@ -1640,20 +1639,20 @@ done:
*/
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)
+ void H5_ATTR_UNUSED *op_data)
{
- hid_t attr = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t type = H5I_INVALID_HID;
- hsize_t size[H5S_MAX_RANK];
- hsize_t nelmts = 1;
- int ndims;
- int i;
- H5S_class_t space_type;
- 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;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t type = H5I_INVALID_HID;
+ hsize_t size[H5S_MAX_RANK];
+ hsize_t nelmts = 1;
+ int ndims;
+ int i;
+ H5S_class_t space_type;
+ 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;
H5TOOLS_START_DEBUG("");
@@ -1661,7 +1660,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
ctx.indent_level = 2;
- ctx.cur_column = (size_t)curr_pos;
+ ctx.cur_column = (size_t)curr_pos;
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " Attribute: ");
@@ -1671,41 +1670,45 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
H5TOOLS_DEBUG("Attribute name:%s", attr_name);
if ((attr = H5Aopen(obj, attr_name, H5P_DEFAULT)) >= 0) {
space = H5Aget_space(attr);
- type = H5Aget_type(attr);
+ type = H5Aget_type(attr);
/* Data space */
- ndims = H5Sget_simple_extent_dims(space, size, NULL);
+ ndims = H5Sget_simple_extent_dims(space, size, NULL);
space_type = H5Sget_simple_extent_type(space);
H5TOOLS_DEBUG("Attribute ndims:%d", ndims);
- switch(space_type) {
+ switch (space_type) {
case H5S_SCALAR:
/* scalar dataspace */
h5tools_str_append(&buffer, " scalar\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
break;
case H5S_SIMPLE:
/* simple dataspace */
h5tools_str_append(&buffer, " {");
for (i = 0; i < ndims; i++) {
- h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i?", ":"", size[i]);
+ h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i ? ", " : "", size[i]);
nelmts *= size[i];
}
h5tools_str_append(&buffer, "}\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
break;
case H5S_NULL:
/* null dataspace */
h5tools_str_append(&buffer, " null\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
break;
case H5S_NO_CLASS:
default:
/* Unknown dataspace type */
h5tools_str_append(&buffer, " unknown\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
break;
} /* end switch */
@@ -1714,7 +1717,8 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
h5tools_str_append(&buffer, " %-10s ", "Type:");
print_type(&buffer, type, 15);
h5tools_str_append(&buffer, "\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
H5Sclose(space);
H5Tclose(type);
@@ -1734,7 +1738,6 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: dataset_list1
*
@@ -1750,16 +1753,16 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
static herr_t
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 */
- h5tool_format_t *info = &ls_dataformat;
+ 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 */
+ h5tool_format_t * info = &ls_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1768,17 +1771,17 @@ dataset_list1(hid_t dset)
/* Information that goes on the same row as the name. The name has
* already been printed. */
- space = H5Dget_space(dset);
+ space = H5Dget_space(dset);
space_type = H5Sget_simple_extent_type(space);
- ndims = H5Sget_simple_extent_dims(space, cur_size, max_size);
+ ndims = H5Sget_simple_extent_dims(space, cur_size, max_size);
h5tools_str_append(&buffer, " {");
for (i = 0; i < ndims; i++) {
- h5tools_str_append(&buffer, "%s"HSIZE_T_FORMAT, i?", ":"", cur_size[i]);
- if (max_size[i]==H5S_UNLIMITED) {
+ h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i ? ", " : "", cur_size[i]);
+ if (max_size[i] == H5S_UNLIMITED) {
h5tools_str_append(&buffer, "/%s", "Inf");
}
else if (max_size[i] != cur_size[i] || verbose_g > 0) {
- h5tools_str_append(&buffer, "/"HSIZE_T_FORMAT, max_size[i]);
+ h5tools_str_append(&buffer, "/" HSIZE_T_FORMAT, max_size[i]);
}
}
if (space_type == H5S_SCALAR)
@@ -1786,15 +1789,15 @@ dataset_list1(hid_t dset)
else if (space_type == H5S_NULL)
h5tools_str_append(&buffer, "NULL");
h5tools_str_append(&buffer, "}");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
- H5Sclose (space);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0,
+ (hsize_t)0);
+ H5Sclose(space);
h5tools_str_close(&buffer);
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: dataset_list2
*
@@ -1808,30 +1811,30 @@ dataset_list1(hid_t dset)
static herr_t
dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
{
- hid_t dcpl; /* dataset creation property list */
- hid_t type; /* data type of dataset */
- hid_t space; /* data space of dataset */
- int nf; /* number of filters */
- unsigned filt_flags; /* filter flags */
- H5Z_filter_t filt_id; /* filter identification number */
- unsigned cd_values[20]; /* filter client data values */
- size_t cd_nelmts; /* filter client number of values */
- size_t cd_num; /* filter client data counter */
- char f_name[256]; /* filter/file name */
- char s[64]; /* temporary string buffer */
- off_t f_offset; /* offset in external file */
- hsize_t f_size; /* bytes used in external file */
- hsize_t total, used; /* total size or offset */
- int ndims; /* dimensionality */
- int n, max_len; /* max extern file name length */
- 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 */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
+ hid_t dcpl; /* dataset creation property list */
+ hid_t type; /* data type of dataset */
+ hid_t space; /* data space of dataset */
+ int nf; /* number of filters */
+ unsigned filt_flags; /* filter flags */
+ H5Z_filter_t filt_id; /* filter identification number */
+ unsigned cd_values[20]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+ size_t cd_num; /* filter client data counter */
+ char f_name[256]; /* filter/file name */
+ char s[64]; /* temporary string buffer */
+ off_t f_offset; /* offset in external file */
+ hsize_t f_size; /* bytes used in external file */
+ hsize_t total, used; /* total size or offset */
+ int ndims; /* dimensionality */
+ int n, max_len; /* max extern file name length */
+ 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 */
+ 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));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1839,26 +1842,24 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
h5tools_str_reset(&buffer);
if (verbose_g > 0) {
- dcpl = H5Dget_create_plist(dset);
+ dcpl = H5Dget_create_plist(dset);
space = H5Dget_space(dset);
- type = H5Dget_type(dset);
+ type = H5Dget_type(dset);
stl = H5Pget_layout(dcpl);
switch (stl) {
- case H5D_CHUNKED:
- {
- hsize_t chsize[64]; /* chunk size in elements */
-
- ndims = H5Pget_chunk(dcpl, (int)NELMTS(chsize), chsize/*out*/);
- h5tools_str_append(&buffer, " %-10s {", "Chunks:");
- total = H5Tget_size(type);
- for (i = 0; i < ndims; i++) {
- h5tools_str_append(&buffer, "%s"HSIZE_T_FORMAT, i?", ":"", chsize[i]);
- total *= chsize[i];
- }
- h5tools_str_append(&buffer, "} "HSIZE_T_FORMAT" bytes\n", total);
+ case H5D_CHUNKED: {
+ hsize_t chsize[64]; /* chunk size in elements */
+
+ ndims = H5Pget_chunk(dcpl, (int)NELMTS(chsize), chsize /*out*/);
+ h5tools_str_append(&buffer, " %-10s {", "Chunks:");
+ total = H5Tget_size(type);
+ for (i = 0; i < ndims; i++) {
+ h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i ? ", " : "", chsize[i]);
+ total *= chsize[i];
}
- break;
+ h5tools_str_append(&buffer, "} " HSIZE_T_FORMAT " bytes\n", total);
+ } break;
case H5D_COMPACT:
break;
case H5D_CONTIGUOUS:
@@ -1867,64 +1868,73 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
for (i = 0, max_len = 0; i < nf; i++) {
if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL) < 0)
continue;
- n = print_string(NULL, f_name, TRUE);
+ n = print_string(NULL, f_name, TRUE);
max_len = MAX(max_len, n);
} /* end for */
- h5tools_str_append(&buffer, " %-10s %d external file%s\n", "Extern:", nf, 1==nf?"":"s");
- h5tools_str_append(&buffer, " %4s %10s %10s %10s %s\n", "ID", "DSet-Addr", "File-Addr", "Bytes", "File");
- h5tools_str_append(&buffer, " %4s %10s %10s %10s ", "----", "----------", "----------", "----------");
+ h5tools_str_append(&buffer, " %-10s %d external file%s\n", "Extern:", nf,
+ 1 == nf ? "" : "s");
+ h5tools_str_append(&buffer, " %4s %10s %10s %10s %s\n", "ID", "DSet-Addr",
+ "File-Addr", "Bytes", "File");
+ h5tools_str_append(&buffer, " %4s %10s %10s %10s ", "----", "----------",
+ "----------", "----------");
for (i = 0; i < max_len; i++)
h5tools_str_append(&buffer, "-");
h5tools_str_append(&buffer, "\n");
- for (i = 0, total=0; i < nf; i++) {
- if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, &f_offset, &f_size)<0) {
- h5tools_str_append(&buffer, " #%03d %10"H5_PRINTF_LL_WIDTH"u %10s %10s ***ERROR*** %s\n",
- i, total, "", "", i+1<nf?"Following addresses are incorrect":"");
+ for (i = 0, total = 0; i < nf; i++) {
+ if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, &f_offset, &f_size) <
+ 0) {
+ h5tools_str_append(
+ &buffer,
+ " #%03d %10" H5_PRINTF_LL_WIDTH "u %10s %10s ***ERROR*** %s\n", i,
+ total, "", "", i + 1 < nf ? "Following addresses are incorrect" : "");
}
else if (H5S_UNLIMITED == f_size) {
- h5tools_str_append(&buffer, " #%03d %10"H5_PRINTF_LL_WIDTH"u %10"H5_PRINTF_LL_WIDTH"u %10s ",
- i, total, (hsize_t)f_offset, "INF");
+ h5tools_str_append(&buffer,
+ " #%03d %10" H5_PRINTF_LL_WIDTH
+ "u %10" H5_PRINTF_LL_WIDTH "u %10s ",
+ i, total, (hsize_t)f_offset, "INF");
print_string(&buffer, f_name, TRUE);
}
else {
- h5tools_str_append(&buffer, " #%03d %10"H5_PRINTF_LL_WIDTH"u %10"H5_PRINTF_LL_WIDTH"u %10"H5_PRINTF_LL_WIDTH"u ",
- i, total, (hsize_t)f_offset, f_size);
+ h5tools_str_append(&buffer,
+ " #%03d %10" H5_PRINTF_LL_WIDTH
+ "u %10" H5_PRINTF_LL_WIDTH "u %10" H5_PRINTF_LL_WIDTH "u ",
+ i, total, (hsize_t)f_offset, f_size);
print_string(&buffer, f_name, TRUE);
}
h5tools_str_append(&buffer, "\n");
total += f_size;
}
- h5tools_str_append(&buffer, " %4s %10s %10s %10s ", "----", "----------", "----------", "----------");
+ h5tools_str_append(&buffer, " %4s %10s %10s %10s ", "----", "----------",
+ "----------", "----------");
for (i = 0; i < max_len; i++)
h5tools_str_append(&buffer, "-");
h5tools_str_append(&buffer, "\n");
} /* end if */
break;
- case H5D_VIRTUAL:
- {
- char dset_name[256]; /* Dataset name */
- size_t vmaps;
+ case H5D_VIRTUAL: {
+ char dset_name[256]; /* Dataset name */
+ size_t vmaps;
- H5Pget_virtual_count(dcpl, &vmaps);
+ H5Pget_virtual_count(dcpl, &vmaps);
- if (vmaps) {
- size_t next;
+ if (vmaps) {
+ size_t next;
- h5tools_str_append(&buffer, " %-10s {%ld} Source {\n", "Maps:", vmaps);
- for (next = 0; next < (unsigned) vmaps; next++) {
- H5Pget_virtual_filename(dcpl, next, f_name, sizeof(f_name));
- H5Pget_virtual_dsetname(dcpl, next, dset_name, sizeof(dset_name));
- h5tools_str_append(&buffer, " %-10s ", " ");
- print_string(&buffer, f_name, TRUE);
- h5tools_str_append(&buffer, " ");
- print_string(&buffer, dset_name, TRUE);
- h5tools_str_append(&buffer, "\n");
- }
- h5tools_str_append(&buffer, " %-10s}\n", " ");
+ h5tools_str_append(&buffer, " %-10s {%ld} Source {\n", "Maps:", vmaps);
+ for (next = 0; next < (unsigned)vmaps; next++) {
+ H5Pget_virtual_filename(dcpl, next, f_name, sizeof(f_name));
+ H5Pget_virtual_dsetname(dcpl, next, dset_name, sizeof(dset_name));
+ h5tools_str_append(&buffer, " %-10s ", " ");
+ print_string(&buffer, f_name, TRUE);
+ h5tools_str_append(&buffer, " ");
+ print_string(&buffer, dset_name, TRUE);
+ h5tools_str_append(&buffer, "\n");
}
+ h5tools_str_append(&buffer, " %-10s}\n", " ");
}
- break;
+ } break;
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
@@ -1933,38 +1943,40 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
break;
}
/* Print total raw storage size */
- total = (hsize_t)H5Sget_simple_extent_npoints(space) * H5Tget_size(type);
- used = H5Dget_storage_size(dset);
+ total = (hsize_t)H5Sget_simple_extent_npoints(space) * H5Tget_size(type);
+ used = H5Dget_storage_size(dset);
tclass = H5Tget_class(type);
h5tools_str_append(&buffer, " %-10s ", "Storage:");
switch (tclass) {
- case H5T_VLEN:
- h5tools_str_append(&buffer, "information not available");
- break;
-
- case H5T_REFERENCE:
- if (H5Tequal(dset, H5T_STD_REF_DSETREG)) {
+ case H5T_VLEN:
h5tools_str_append(&buffer, "information not available");
- }
- break;
+ break;
- case H5T_NO_CLASS:
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_TIME:
- case H5T_STRING:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_COMPOUND:
- case H5T_ENUM:
- case H5T_ARRAY:
- 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) {
- utilization = ((double)total * (double)100.0f) / (double)used;
- h5tools_str_append(&buffer, ", %1.2f%% utilization", utilization);
- }
+ case H5T_REFERENCE:
+ if (H5Tequal(dset, H5T_STD_REF_DSETREG)) {
+ h5tools_str_append(&buffer, "information not available");
+ }
+ break;
+
+ case H5T_NO_CLASS:
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_ENUM:
+ case H5T_ARRAY:
+ 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) {
+ utilization = ((double)total * (double)100.0f) / (double)used;
+ h5tools_str_append(&buffer, ", %1.2f%% utilization", utilization);
+ }
}
h5tools_str_append(&buffer, "\n");
@@ -1973,23 +1985,27 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
if ((nf = H5Pget_nfilters(dcpl)) > 0) {
for (i = 0; i < nf; i++) {
cd_nelmts = NELMTS(cd_values);
- filt_id = H5Pget_filter2(dcpl, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name, NULL);
+ filt_id = H5Pget_filter2(dcpl, (unsigned)i, &filt_flags, &cd_nelmts, cd_values,
+ sizeof(f_name), f_name, NULL);
f_name[sizeof(f_name) - 1] = '\0';
HDsnprintf(s, sizeof(s), "Filter-%d:", i);
- h5tools_str_append(&buffer, " %-10s %s-%u %s {", s, (f_name[0] ? f_name : "method"), (unsigned)filt_id, ((filt_flags & H5Z_FLAG_OPTIONAL) ? "OPT" : ""));
+ h5tools_str_append(&buffer, " %-10s %s-%u %s {", s, (f_name[0] ? f_name : "method"),
+ (unsigned)filt_id, ((filt_flags & H5Z_FLAG_OPTIONAL) ? "OPT" : ""));
for (cd_num = 0; cd_num < cd_nelmts; cd_num++)
h5tools_str_append(&buffer, "%s%u", (cd_num ? ", " : ""), cd_values[cd_num]);
h5tools_str_append(&buffer, "}\n");
} /* end for */
- } /* end if */
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ } /* end if */
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
/* Print data type */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " %-10s ", "Type:");
print_type(&buffer, type, 15);
h5tools_str_append(&buffer, "\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
/* Print address information */
if (address_g)
@@ -2009,7 +2025,6 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
return 0;
} /* end dataset_list2() */
-
/*-------------------------------------------------------------------------
* Function: datatype_list2
*
@@ -2024,10 +2039,10 @@ 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 */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
+ 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));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2037,14 +2052,14 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name)
h5tools_str_append(&buffer, " %-10s ", "Type:");
print_type(&buffer, type, 15);
h5tools_str_append(&buffer, "\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
}
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: list_obj
*
@@ -2057,12 +2072,12 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name)
static herr_t
list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void *_iter)
{
- 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 */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
+ 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 */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t * info = &ls_dataformat;
H5TOOLS_START_DEBUG("");
@@ -2085,7 +2100,8 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
h5tools_str_append(&buffer, "{");
if (obj_type >= 0 && dispatch_g[obj_type].name)
h5tools_str_append(&buffer, "%s", dispatch_g[obj_type].name);
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0,
+ (hsize_t)0);
/* Check if we've seen this object before */
if (first_seen) {
@@ -2095,10 +2111,11 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
if (!iter->symlink_target) {
h5tools_str_append(&buffer, "\n");
}
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ 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_id = H5I_INVALID_HID; /* ID of object opened */
+ hid_t obj_id = 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.
@@ -2107,7 +2124,8 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
if (obj_type >= 0 && (obj_id = H5Oopen(iter->fid, name, H5P_DEFAULT)) < 0) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " *ERROR*\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
goto done;
} /* end if */
@@ -2118,14 +2136,15 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
if (!iter->symlink_target || (verbose_g > 0)) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
}
/* Show detailed information about the object, beginning with information
* which is common to all objects. */
if (verbose_g > 0) {
- size_t buf_size = 0;
- char* comment = NULL;
+ size_t buf_size = 0;
+ char * comment = NULL;
ssize_t cmt_bufsize = -1;
/* Display attributes */
@@ -2135,16 +2154,18 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
/* Object location & reference count */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, " %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oinfo->fileno, oinfo->addr);
+ h5tools_str_append(&buffer, " %-10s %lu:" H5_PRINTF_HADDR_FMT "\n", "Location:", oinfo->fileno,
+ oinfo->addr);
h5tools_str_append(&buffer, " %-10s %u\n", "Links:", (unsigned)oinfo->rc);
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
/* Modification time */
if (oinfo->mtime > 0) {
- char buf[256];
+ char buf[256];
struct tm *tm;
- if(simple_output_g)
+ if (simple_output_g)
tm = HDgmtime(&(oinfo->mtime));
else
tm = HDlocaltime(&(oinfo->mtime));
@@ -2152,9 +2173,10 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, " %-10s %s\n", "Modified:", buf);
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos,
+ (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
} /* end if */
- } /* end if */
+ } /* end if */
/* Object comment */
cmt_bufsize = H5Oget_comment(obj_id, comment, buf_size);
@@ -2172,7 +2194,8 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
h5tools_str_append(&buffer, " %-10s \"", "Comment:");
print_string(&buffer, comment, FALSE);
h5tools_str_append(&buffer, "\"\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos,
+ (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
} /* end if */
HDfree(comment);
}
@@ -2192,7 +2215,8 @@ done:
if (iter->symlink_target) {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "}\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
iter->symlink_target = FALSE;
}
h5tools_str_close(&buffer);
@@ -2202,7 +2226,6 @@ done:
return 0;
} /* end list_obj() */
-
/*-------------------------------------------------------------------------
* Function: list_lnk
*
@@ -2215,14 +2238,14 @@ done:
static herr_t
list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
{
- 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;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
+ 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;
+ 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));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2234,17 +2257,17 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
/* if verbose, make H5tools_get_symlink_info() display more */
if (verbose_g)
- lnk_info.opt.msg_mode=1;
+ lnk_info.opt.msg_mode = 1;
/* Print the link's name, either full name or base name */
print_obj_name(&buffer, iter, name, "");
- switch(linfo->type) {
+ switch (linfo->type) {
case H5L_TYPE_SOFT:
ret = H5tools_get_symlink_info(iter->fid, name, &lnk_info, follow_symlink_g);
/* lnk_info.trg_path is malloced in H5tools_get_symlink_info()
* so it will be freed via buf later */
- buf = (char*)lnk_info.trg_path;
+ buf = (char *)lnk_info.trg_path;
/* error */
if (ret < 0)
goto done;
@@ -2255,7 +2278,8 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
h5tools_str_append(&buffer, "Soft Link {");
h5tools_str_append(&buffer, buf);
h5tools_str_append(&buffer, "}");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
if (follow_symlink_g) {
hbool_t orig_grp_literal = grp_literal_g;
h5tools_str_reset(&buffer);
@@ -2264,10 +2288,12 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
/* Check if we have already seen this softlink */
if (symlink_is_visited(iter->symlink_list, linfo->type, NULL, buf)) {
h5tools_str_append(&buffer, "{Already Visited}\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos,
+ (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
goto done;
}
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
/* Add this link to the list of seen softlinks */
if (symlink_visit_add(iter->symlink_list, linfo->type, NULL, buf) < 0)
@@ -2292,21 +2318,21 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
else {
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
}
break;
- case H5L_TYPE_EXTERNAL:
- {
+ case H5L_TYPE_EXTERNAL: {
const char *filename;
const char *path;
- hbool_t follow_link = follow_symlink_g || follow_elink_g;
+ hbool_t follow_link = follow_symlink_g || follow_elink_g;
ret = H5tools_get_symlink_info(iter->fid, name, &lnk_info, follow_link);
/* lnk_info.trg_path is malloced in H5tools_get_symlink_info()
* so it will be freed via buf later */
- buf = (char*)lnk_info.trg_path;
+ buf = (char *)lnk_info.trg_path;
/* error */
if (ret < 0)
goto done;
@@ -2320,11 +2346,12 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
h5tools_str_append(&buffer, "External Link {");
h5tools_str_append(&buffer, filename);
h5tools_str_append(&buffer, "/");
- if(*path != '/')
+ if (*path != '/')
h5tools_str_append(&buffer, "/");
h5tools_str_append(&buffer, path);
h5tools_str_append(&buffer, "}");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
/* Recurse through the external link */
/* keep the follow_elink_g for backward compatibility with -E */
@@ -2336,10 +2363,12 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
/* Check if we have already seen this elink */
if (symlink_is_visited(iter->symlink_list, linfo->type, filename, path)) {
h5tools_str_append(&buffer, "{Already Visited}\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos,
+ (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
goto done;
}
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
/* Add this link to the list of seen elinks */
if (symlink_visit_add(iter->symlink_list, linfo->type, filename, path) < 0) {
@@ -2365,15 +2394,15 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
}
else
PRINTVALSTREAM(rawoutstream, "\n");
- }
- break;
+ } break;
case H5L_TYPE_ERROR:
case H5L_TYPE_HARD:
case H5L_TYPE_MAX:
default:
h5tools_str_append(&buffer, "UD Link {cannot follow UD links}\n");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
break;
} /* end switch */
@@ -2385,7 +2414,6 @@ done:
return 0;
} /* end list_lnk() */
-
/*-------------------------------------------------------------------------
* Function: visit_obj
*
@@ -2398,12 +2426,12 @@ done:
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 */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *info = &ls_dataformat;
+ 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;
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2411,14 +2439,15 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
h5tools_str_reset(&buffer);
/* Retrieve info for object to list */
- if (H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_BASIC | H5O_INFO_TIME, H5P_DEFAULT) < 0) {
if (iter->symlink_target) {
h5tools_str_append(&buffer, "{**NOT FOUND**}\n");
iter->symlink_target = FALSE;
}
else
print_obj_name(&buffer, iter, oname, "**NOT FOUND**");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
retval = -1;
goto done;
} /* end if */
@@ -2428,18 +2457,20 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
/* Get ID for group */
if (!iter->symlink_target && (iter->gid = H5Gopen2(file, oname, H5P_DEFAULT)) < 0) {
h5tools_str_append(&buffer, "%s: unable to open '%s' as group\n", iter->fname, oname);
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
- goto done; /* Previously "continue", when this code was in main().
- * We don't "continue" here in order to close the file
- * and free the file name properly. */
- } /* end if */
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
+ goto done; /* Previously "continue", when this code was in main().
+ * We don't "continue" here in order to close the file
+ * and free the file name properly. */
+ } /* end if */
/* Delay specifying the name start point so the original object name is
* displayed if it is a link or non-group object */
iter->name_start = iter->base_len;
/* Specified name is a group. List the complete contents of the group. */
- h5trav_visit(file, oname, (hbool_t) (display_root_g || iter->symlink_target), recursive_g, list_obj, list_lnk, iter, H5O_INFO_BASIC|H5O_INFO_TIME);
+ h5trav_visit(file, oname, (hbool_t)(display_root_g || iter->symlink_target), recursive_g, list_obj,
+ list_lnk, iter, H5O_INFO_BASIC | H5O_INFO_TIME);
/* Close group */
if (!iter->symlink_target)
@@ -2459,7 +2490,6 @@ done:
return retval;
}
-
/*-------------------------------------------------------------------------
* Function: get_width
*
@@ -2475,7 +2505,7 @@ done:
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
@@ -2515,14 +2545,14 @@ get_width(void)
{
/* Unix with ioctl(TIOCGWINSZ) */
struct winsize w;
- if (ioctl(2, (int)TIOCGWINSZ, &w)>=0 && w.ws_col>0)
+ if (ioctl(2, (int)TIOCGWINSZ, &w) >= 0 && w.ws_col > 0)
width = w.ws_col;
}
#elif defined(H5_HAVE_TIOCGETD) && defined(H5_HAVE_IOCTL)
{
/* Unix with ioctl(TIOCGETD) */
struct uwdata w;
- if (ioctl(2, WIOCGETD, &w)>=0 && w.uw_width>0)
+ if (ioctl(2, WIOCGETD, &w) >= 0 && w.uw_width > 0)
width = w.uw_width / w.uw_hs;
}
#endif
@@ -2553,7 +2583,8 @@ is_valid_args(void)
}
if (no_dangling_link_g && !follow_symlink_g) {
- HDfprintf(rawerrorstream, "Error: --no-dangling-links must be used along with --follow-symlinks option!\n\n");
+ HDfprintf(rawerrorstream,
+ "Error: --no-dangling-links must be used along with --follow-symlinks option!\n\n");
ret = FALSE;
goto out;
}
@@ -2562,7 +2593,6 @@ out:
return ret;
}
-
/*-------------------------------------------------------------------------
* Function: leave
*
@@ -2579,7 +2609,6 @@ leave(int ret)
HDexit(ret);
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -2592,16 +2621,16 @@ leave(int ret)
int
main(int argc, const char *argv[])
{
- hid_t file_id = H5I_INVALID_HID;
- char *fname = NULL, *oname = NULL, *x;
- const char *s = NULL;
- char *rest;
- int argno;
- static char root_name[] = "/";
- char drivername[50];
- const char *preferred_driver = NULL;
- int err_exit = 0;
- hid_t fapl_id = H5P_DEFAULT;
+ hid_t file_id = H5I_INVALID_HID;
+ char * fname = NULL, *oname = NULL, *x;
+ const char *s = NULL;
+ char * rest;
+ int argno;
+ static char root_name[] = "/";
+ char drivername[50];
+ const char *preferred_driver = NULL;
+ int err_exit = 0;
+ hid_t fapl_id = H5P_DEFAULT;
#ifdef H5_HAVE_ROS3_VFD
/* Default "anonymous" S3 configuration */
@@ -2654,12 +2683,12 @@ main(int argc, const char *argv[])
else if (!HDstrcmp(argv[argno], "--address")) {
address_g = TRUE;
}
- else if(!HDstrcmp(argv[argno], "--data")) {
+ else if (!HDstrcmp(argv[argno], "--data")) {
data_g = TRUE;
}
else if (!HDstrcmp(argv[argno], "--enable-error-stack")) {
enable_error_stack = 1;
- /* deprecated --errors */
+ /* deprecated --errors */
}
else if (!HDstrcmp(argv[argno], "--errors")) {
enable_error_stack = 1;
@@ -2684,7 +2713,7 @@ main(int argc, const char *argv[])
}
else if (!HDstrcmp(argv[argno], "--recursive")) {
recursive_g = TRUE;
- fullname_g = TRUE;
+ fullname_g = TRUE;
}
else if (!HDstrcmp(argv[argno], "--simple")) {
simple_output_g = TRUE;
@@ -2693,10 +2722,10 @@ main(int argc, const char *argv[])
string_g = TRUE;
}
else if (!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) {
- preferred_driver = argv[argno]+6;
+ preferred_driver = argv[argno] + 6;
}
else if (!HDstrncmp(argv[argno], "--width=", (size_t)8)) {
- width_g = (int)HDstrtol(argv[argno]+8, &rest, 0);
+ width_g = (int)HDstrtol(argv[argno] + 8, &rest, 0);
if (0 == width_g)
no_line_wrap_g = TRUE;
@@ -2742,14 +2771,13 @@ main(int argc, const char *argv[])
}
width_g = (int)HDstrtol(s, &rest, 0);
- if(0 == width_g) {
+ if (0 == width_g) {
no_line_wrap_g = TRUE;
}
- else if(width_g < 0 || *rest) {
+ else if (width_g < 0 || *rest) {
usage();
leave(EXIT_FAILURE);
}
-
}
else if (!HDstrncmp(argv[argno], "--s3-cred=", (size_t)10)) {
#ifdef H5_HAVE_ROS3_VFD
@@ -2757,7 +2785,8 @@ 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);
@@ -2779,8 +2808,8 @@ main(int argc, const char *argv[])
#ifdef H5_HAVE_LIBHDFS
char const *start = NULL;
- start = argv[argno]+13; /* should never segfault: worst case of */
- if (*start != '(') { /* null-termintor after '='. */
+ start = argv[argno] + 13; /* should never segfault: worst case of */
+ if (*start != '(') { /* null-termintor after '='. */
usage();
leave(EXIT_FAILURE);
}
@@ -2796,10 +2825,10 @@ main(int argc, const char *argv[])
leave(EXIT_FAILURE);
#endif
}
- else if('-'!=argv[argno][1]) {
+ else if ('-' != argv[argno][1]) {
/* Single-letter switches */
- for(s = argv[argno] + 1; *s; s++) {
- switch(*s) {
+ for (s = argv[argno] + 1; *s; s++) {
+ switch (*s) {
case '?':
case 'h': /* --help */
usage();
@@ -2837,7 +2866,7 @@ main(int argc, const char *argv[])
case 'r': /* --recursive */
recursive_g = TRUE;
- fullname_g = TRUE;
+ fullname_g = TRUE;
break;
case 'S': /* --simple */
@@ -2865,7 +2894,7 @@ main(int argc, const char *argv[])
usage();
leave(EXIT_FAILURE);
} /* end switch */
- } /* end for */
+ } /* end for */
}
else {
HDfprintf(stderr, "Unknown argument: %s\n", argv[argno]);
@@ -2893,8 +2922,8 @@ main(int argc, const char *argv[])
if (preferred_driver) {
h5tools_vfd_info_t vfd_info;
- vfd_info.info = NULL;
- vfd_info.name = preferred_driver;
+ vfd_info.info = NULL;
+ vfd_info.name = preferred_driver;
if (!HDstrcmp(preferred_driver, drivernames[ROS3_VFD_IDX])) {
#ifdef H5_HAVE_ROS3_VFD
@@ -2931,29 +2960,29 @@ main(int argc, const char *argv[])
* chops off the last component. If we reach the beginning of the name
* then there must have been something wrong with the file (perhaps it
* doesn't exist). */
- show_file_name_g = (argc-argno > 1); /*show file names if more than one*/
- while(argno < argc) {
- H5L_info_t li;
- iter_t iter;
+ show_file_name_g = (argc - argno > 1); /*show file names if more than one*/
+ while (argno < argc) {
+ H5L_info_t li;
+ iter_t iter;
symlink_trav_t symlink_list;
- size_t u;
+ size_t u;
- fname = HDstrdup(argv[argno++]);
- oname = NULL;
+ fname = HDstrdup(argv[argno++]);
+ oname = NULL;
file_id = H5I_INVALID_HID;
while (fname && *fname) {
- file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id,
- (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, drivername, sizeof drivername);
+ file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE,
+ drivername, sizeof drivername);
if (file_id >= 0) {
if (verbose_g)
PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername);
break; /*success*/
- } /* end if */
+ } /* end if */
/* Shorten the file name; lengthen the object name */
- x = oname;
+ x = oname;
oname = HDstrrchr(fname, '/');
if (x)
*x = '/';
@@ -2963,7 +2992,7 @@ main(int argc, const char *argv[])
} /* end while */
if (file_id < 0) {
- HDfprintf(rawerrorstream, "%s: unable to open file\n", argv[argno-1]);
+ HDfprintf(rawerrorstream, "%s: unable to open file\n", argv[argno - 1]);
HDfree(fname);
err_exit = 1;
continue;
@@ -2971,9 +3000,9 @@ main(int argc, const char *argv[])
if (oname) {
/* Always use absolute paths to avoid confusion, keep track of where
* to begin path name output */
- *oname = '/';
+ *oname = '/';
iter.base_len = HDstrlen(oname);
- iter.base_len -= oname[iter.base_len-1] == '/';
+ iter.base_len -= oname[iter.base_len - 1] == '/';
x = oname;
if (NULL == (oname = HDstrdup(oname))) {
HDfprintf(rawerrorstream, "memory allocation failed\n");
@@ -2988,42 +3017,43 @@ main(int argc, const char *argv[])
oname = root_name;
if (recursive_g)
display_root_g = TRUE;
- iter.base_len = 0;
+ iter.base_len = 0;
iter.name_start = 0;
/* Use x to remember if we have allocated space in oname */
x = NULL;
} /* end if */
/* Remember the file information for later */
- iter.fname = fname;
- iter.fid = file_id;
- iter.gid = H5I_INVALID_HID;
- iter.symlink_target = FALSE;
- iter.symlink_list = &symlink_list;
+ iter.fname = fname;
+ iter.fid = file_id;
+ iter.gid = H5I_INVALID_HID;
+ iter.symlink_target = FALSE;
+ iter.symlink_list = &symlink_list;
iter.symlink_list->dangle_link = FALSE;
/* Initialize list of visited symbolic links */
symlink_list.nused = symlink_list.nalloc = 0;
- symlink_list.objs = NULL;
+ symlink_list.objs = NULL;
/* Check for root group as object name */
if (HDstrcmp(oname, root_name)) {
/* Check the type of link given */
if (H5Lget_info(file_id, oname, &li, H5P_DEFAULT) < 0) {
- 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;
+ 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));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
h5tools_str_reset(&buffer);
print_obj_name(&buffer, &iter, oname, "**NOT FOUND**");
- h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols,
+ (hsize_t)0, (hsize_t)0);
leave(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
else
li.type = H5L_TYPE_HARD;
@@ -3069,4 +3099,3 @@ main(int argc, const char *argv[])
else
leave(EXIT_SUCCESS);
} /* end main() */
-
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 77f2272..82b5601 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -22,10 +22,10 @@
*-------------------------------------------------------------------------
*/
-static int check_options(pack_opt_t *options);
-static int check_objects(const char* fname, pack_opt_t *options);
-static const char* get_sfilter(H5Z_filter_t filtn);
-static int have_request(pack_opt_t *options);
+static int check_options(pack_opt_t *options);
+static int check_objects(const char *fname, pack_opt_t *options);
+static const char *get_sfilter(H5Z_filter_t filtn);
+static int have_request(pack_opt_t *options);
/*-------------------------------------------------------------------------
* Function: h5repack
@@ -42,7 +42,7 @@ static int have_request(pack_opt_t *options);
*-------------------------------------------------------------------------
*/
int
-h5repack(const char* infile, const char* outfile, pack_opt_t *options)
+h5repack(const char *infile, const char *outfile, pack_opt_t *options)
{
/* check input */
if (check_options(options) < 0)
@@ -73,17 +73,17 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest)
int k, n;
HDmemset(options, 0, sizeof(pack_opt_t));
- options->min_comp = 0;
- options->verbose = verbose;
- options->latest = latest;
- options->layout_g = H5D_LAYOUT_ERROR;
- options->low_bound = H5F_LIBVER_EARLIEST;
+ options->min_comp = 0;
+ options->verbose = verbose;
+ options->latest = latest;
+ options->layout_g = H5D_LAYOUT_ERROR;
+ options->low_bound = H5F_LIBVER_EARLIEST;
options->high_bound = H5F_LIBVER_LATEST;
- options->fin_fapl = H5P_DEFAULT;
- options->fout_fapl = H5P_DEFAULT;
+ options->fin_fapl = H5P_DEFAULT;
+ options->fout_fapl = H5P_DEFAULT;
for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) {
- options->filter_g[n].filtn = -1;
+ options->filter_g[n].filtn = -1;
options->filter_g[n].cd_nelmts = 0;
for (k = 0; k < CD_VALUES; k++)
options->filter_g[n].cd_values[k] = 0;
@@ -117,7 +117,7 @@ h5repack_end(pack_opt_t *options)
int
h5repack_addfilter(const char *str, pack_opt_t *options)
{
- obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */
+ obj_list_t * obj_list = NULL; /* one object list for the -f and -l option entry */
filter_info_t filter; /* filter info for the current -f option entry */
unsigned n_objs; /* number of objects in the current -f or -l option entry */
int is_glb; /* is the filter global */
@@ -166,7 +166,7 @@ h5repack_addlayout(const char *str, pack_opt_t *options)
init_packobject(&pack);
if (options->all_layout == 1) {
- error_msg( "invalid layout input: 'all' option is present with other objects <%s>\n", str);
+ error_msg("invalid layout input: 'all' option is present with other objects <%s>\n", str);
return ret_value;
}
@@ -222,11 +222,12 @@ h5repack_addlayout(const char *str, pack_opt_t *options)
*-------------------------------------------------------------------------
*/
hid_t
-copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options)
+copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt,
+ pack_opt_t *options)
{
- named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
- named_dt_t *dt_ret = NULL; /* Datatype to return */
- H5O_info_t oinfo; /* Object info of input dtype */
+ named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
+ named_dt_t *dt_ret = NULL; /* Datatype to return */
+ H5O_info_t oinfo; /* Object info of input dtype */
hid_t ret_value = H5I_INVALID_HID;
if (H5Oget_info2(type_in, &oinfo, H5O_INFO_BASIC) < 0)
@@ -247,20 +248,20 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t
/* Push onto the stack */
if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t))))
H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "buffer allocation failed failed");
- dt->next = *named_dt_head_p;
+ dt->next = *named_dt_head_p;
*named_dt_head_p = dt;
/* Update the address and id */
dt->addr_in = travt->objs[i].objno;
- dt->id_out = H5I_INVALID_HID;
+ dt->id_out = H5I_INVALID_HID;
/* Check if this type is the one requested */
if (oinfo.addr == dt->addr_in) {
dt_ret = dt;
}
} /* end if named datatype */
- } /* end for each object in traversal table */
- } /* end else (create the stack) */
+ } /* end for each object in traversal table */
+ } /* end else (create the stack) */
/* Handle the case that the requested datatype was not found. This is
* possible if the datatype was committed anonymously in the input file.
@@ -269,12 +270,12 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t
/* Push the new datatype onto the stack */
if (NULL == (dt_ret = (named_dt_t *)HDmalloc(sizeof(named_dt_t))))
H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "buffer allocation failed failed");
- dt_ret->next = *named_dt_head_p;
+ dt_ret->next = *named_dt_head_p;
*named_dt_head_p = dt_ret;
/* Update the address and id */
dt_ret->addr_in = oinfo.addr;
- dt_ret->id_out = H5I_INVALID_HID;
+ dt_ret->id_out = H5I_INVALID_HID;
} /* end if requested datatype not found */
/* If the requested datatype does not yet exist in the output file, copy it
@@ -313,8 +314,8 @@ done:
int
named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err)
{
- named_dt_t *dt = *named_dt_head_p;
- int ret_value = -1;
+ named_dt_t *dt = *named_dt_head_p;
+ int ret_value = -1;
while (dt) {
/* Pop the datatype off the stack and free it */
@@ -345,24 +346,24 @@ done:
int
copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options)
{
- hid_t attr_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr_id = H5I_INVALID_HID; /* attr ID */
hid_t attr_out = H5I_INVALID_HID; /* attr ID */
hid_t space_id = H5I_INVALID_HID; /* space ID */
hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
- size_t msize; /* size of type */
- void *buf = NULL; /* data buffer */
- hsize_t nelmts; /* number of elements in dataset */
- int rank; /* rank of dataset */
- htri_t is_named; /* Whether the datatype is named */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ size_t msize; /* size of type */
+ void * buf = NULL; /* data buffer */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ htri_t is_named; /* Whether the datatype is named */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
char name[255];
- H5O_info_t oinfo; /* object info */
+ H5O_info_t oinfo; /* object info */
int j;
unsigned u;
- hbool_t is_ref = 0;
+ hbool_t is_ref = 0;
H5T_class_t type_class = -1;
- int ret_value = 0;
+ int ret_value = 0;
if (H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed");
@@ -371,12 +372,13 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
* copy all attributes
*-------------------------------------------------------------------------
*/
- for (u = 0; u < (unsigned) oinfo.num_attrs; u++) {
+ for (u = 0; u < (unsigned)oinfo.num_attrs; u++) {
/* open attribute */
- if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aopen_by_idx failed");
- if (H5Aget_name(attr_id, (size_t) 255, name) < 0)
+ if (H5Aget_name(attr_id, (size_t)255, name) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
/* get the file datatype */
@@ -432,12 +434,12 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
*---------------------------------------------------------------------
*/
type_class = H5Tget_class(wtype_id);
- is_ref = (type_class == H5T_REFERENCE);
+ is_ref = (type_class == H5T_REFERENCE);
if (type_class == H5T_VLEN || type_class == H5T_ARRAY) {
hid_t base_type = H5I_INVALID_HID;
base_type = H5Tget_super(ftype_id);
- is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE));
+ is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE));
if (H5Tclose(base_type) < 0)
H5TOOLS_ERROR((-1), "H5Tclose base_type failed");
} /* end if type_class is variable length or array */
@@ -446,7 +448,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
int nmembers = H5Tget_nmembers(wtype_id);
for (j = 0; j < nmembers; j++) {
- hid_t mtid = H5Tget_member_type(wtype_id, (unsigned)j);
+ hid_t mtid = H5Tget_member_type(wtype_id, (unsigned)j);
H5T_class_t mtclass = H5Tget_class(mtid);
if (H5Tclose(mtid) < 0)
H5TOOLS_ERROR((-1), "H5Tclose mtid failed");
@@ -456,7 +458,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
break;
}
} /* end for each member */
- } /* end if type_class is H5T_COMPOUND */
+ } /* end if type_class is H5T_COMPOUND */
if (!is_ref) {
/*-----------------------------------------------------------------
@@ -515,7 +517,8 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
} /* for u (each attribute) */
done:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
if (buf) {
/* Check if we have VL data and string in the attribute's
* datatype that must be reclaimed
@@ -532,7 +535,8 @@ done:
H5Tclose(wtype_id);
H5Tclose(ftype_id);
H5Aclose(attr_id);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return ret_value;
} /* end copy_attr() */
@@ -561,31 +565,31 @@ check_options(pack_opt_t *options)
if (options->all_layout == 1) {
HDprintf("All objects to modify layout are...\n");
switch (options->layout_g) {
- case H5D_COMPACT:
- strcpy(slayout, "compact");
- break;
- case H5D_CONTIGUOUS:
- strcpy(slayout, "contiguous");
- break;
- case H5D_CHUNKED:
- strcpy(slayout, "chunked");
- break;
- case H5D_VIRTUAL:
- strcpy(slayout, "virtual");
- break;
- case H5D_LAYOUT_ERROR:
- case H5D_NLAYOUTS:
- H5TOOLS_GOTO_ERROR((-1), "invalid layout");
- break;
- default:
- strcpy(slayout, "invalid layout\n");
- H5TOOLS_GOTO_DONE((-1));
+ case H5D_COMPACT:
+ strcpy(slayout, "compact");
+ break;
+ case H5D_CONTIGUOUS:
+ strcpy(slayout, "contiguous");
+ break;
+ case H5D_CHUNKED:
+ strcpy(slayout, "chunked");
+ break;
+ case H5D_VIRTUAL:
+ strcpy(slayout, "virtual");
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
+ H5TOOLS_GOTO_ERROR((-1), "invalid layout");
+ break;
+ default:
+ strcpy(slayout, "invalid layout\n");
+ H5TOOLS_GOTO_DONE((-1));
}
HDprintf(" Apply %s layout to all", slayout);
if (H5D_CHUNKED == options->layout_g) {
HDprintf("with dimension [ ");
for (j = 0; j < options->chunk_g.rank; j++)
- HDprintf("%d ", (int) options->chunk_g.chunk_lengths[j]);
+ HDprintf("%d ", (int)options->chunk_g.chunk_lengths[j]);
HDprintf("]");
}
HDprintf("\n");
@@ -595,13 +599,13 @@ check_options(pack_opt_t *options)
} /* end if verbose */
for (i = 0; i < options->op_tbl->nelems; i++) {
- char* name = options->op_tbl->objs[i].path;
+ char *name = options->op_tbl->objs[i].path;
if (options->op_tbl->objs[i].chunk.rank > 0) {
if (options->verbose) {
HDprintf(" <%s> with chunk size ", name);
for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++)
- HDprintf("%d ", (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]);
+ HDprintf("%d ", (int)options->op_tbl->objs[i].chunk.chunk_lengths[k]);
HDprintf("\n");
}
has_ck = 1;
@@ -631,36 +635,38 @@ check_options(pack_opt_t *options)
continue;
}
switch (filtn) {
- case H5Z_FILTER_NONE:
- HDprintf(" Uncompress all\n");
- break;
- case H5Z_FILTER_SHUFFLE:
- case H5Z_FILTER_FLETCHER32:
- HDprintf(" All with %s\n", get_sfilter(filtn));
- break;
- case H5Z_FILTER_SZIP:
- case H5Z_FILTER_DEFLATE:
- HDprintf(" All with %s, parameter %d\n", get_sfilter(filtn), options->filter_g[k].cd_values[0]);
- break;
- default:
- HDprintf(" User Defined %d\n", filtn);
- break;
+ case H5Z_FILTER_NONE:
+ HDprintf(" Uncompress all\n");
+ break;
+ case H5Z_FILTER_SHUFFLE:
+ case H5Z_FILTER_FLETCHER32:
+ HDprintf(" All with %s\n", get_sfilter(filtn));
+ break;
+ case H5Z_FILTER_SZIP:
+ case H5Z_FILTER_DEFLATE:
+ HDprintf(" All with %s, parameter %d\n", get_sfilter(filtn),
+ options->filter_g[k].cd_values[0]);
+ break;
+ default:
+ HDprintf(" User Defined %d\n", filtn);
+ break;
} /* end switch */
- } /* end for each filter */
- } /* end if options->all_filter == 1 (TODO: meaning) */
+ } /* end for each filter */
+ } /* end if options->all_filter == 1 (TODO: meaning) */
else
HDprintf("No all objects to apply filter\n");
} /* end if verbose */
for (i = 0; i < options->op_tbl->nelems; i++) {
pack_info_t pack = options->op_tbl->objs[i];
- char* name = pack.path;
+ char * name = pack.path;
for (j = 0; j < pack.nfilters; j++) {
if (options->verbose) {
if (pack.filter[j].filtn >= 0) {
if (pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET) {
- HDprintf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn), pack.filter[j].filtn);
+ HDprintf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn),
+ pack.filter[j].filtn);
}
else {
HDprintf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn));
@@ -669,7 +675,7 @@ check_options(pack_opt_t *options)
}
has_cp = 1;
} /* end for each filter */
- } /* end for each object in options table */
+ } /* end for each object in options table */
if (options->all_filter == 1 && has_cp)
H5TOOLS_GOTO_ERROR((-1), "invalid compression input: 'all' option is present with other objects");
@@ -695,7 +701,8 @@ check_options(pack_opt_t *options)
*/
if (options->ublock_filename != NULL && options->ublock_size == 0) {
if (options->verbose) {
- HDprintf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", options->ublock_filename);
+ HDprintf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n",
+ options->ublock_filename);
options->ublock_size = 1024;
}
}
@@ -725,14 +732,14 @@ done:
*-------------------------------------------------------------------------
*/
static int
-check_objects(const char* fname, pack_opt_t *options)
+check_objects(const char *fname, pack_opt_t *options)
{
hid_t fid = H5I_INVALID_HID;
hid_t did = H5I_INVALID_HID;
hid_t sid = H5I_INVALID_HID;
unsigned int i;
int ifil;
- trav_table_t *travt = NULL;
+ trav_table_t *travt = NULL;
int ret_value = 0;
/* nothing to do */
@@ -744,7 +751,7 @@ check_objects(const char* fname, pack_opt_t *options)
*-------------------------------------------------------------------------
*/
if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, options->fin_fapl,
- (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
+ (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR);
/*-------------------------------------------------------------------------
@@ -770,8 +777,8 @@ check_objects(const char* fname, pack_opt_t *options)
HDprintf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs);
for (i = 0; i < options->op_tbl->nelems; i++) {
- pack_info_t obj = options->op_tbl->objs[i];
- char* name = obj.path;
+ pack_info_t obj = options->op_tbl->objs[i];
+ char * name = obj.path;
if (options->verbose)
HDprintf(" <%s>", name);
@@ -779,7 +786,7 @@ check_objects(const char* fname, pack_opt_t *options)
/* the input object names are present in the file and are valid */
if (h5trav_getindext(name, travt) < 0)
H5TOOLS_GOTO_ERROR((-1), "%s Could not find <%s> in file <%s>. Exiting...\n",
- (options->verbose ? "\n" : ""), name, fname);
+ (options->verbose ? "\n" : ""), name, fname);
if (options->verbose)
HDprintf("...Found\n");
@@ -788,14 +795,13 @@ check_objects(const char* fname, pack_opt_t *options)
H5TOOLS_GOTO_ERROR((-1), "invalid filter");
/* check for extra filter conditions */
switch (obj.filter[ifil].filtn) {
- /* chunk size must be smaller than pixels per block */
- case H5Z_FILTER_SZIP:
- {
- int j;
- hsize_t csize = 1;
- unsigned ppb = obj.filter[ifil].cd_values[0];
- hsize_t dims[H5S_MAX_RANK];
- int rank;
+ /* chunk size must be smaller than pixels per block */
+ case H5Z_FILTER_SZIP: {
+ int j;
+ hsize_t csize = 1;
+ unsigned ppb = obj.filter[ifil].cd_values[0];
+ hsize_t dims[H5S_MAX_RANK];
+ int rank;
if (obj.chunk.rank > 0) {
rank = obj.chunk.rank;
@@ -826,18 +832,20 @@ check_objects(const char* fname, pack_opt_t *options)
}
} /* end case SZIP */
break;
- default:
- break;
+ default:
+ break;
} /* end switch */
- } /* for ifil (each user-defined filter) */
- } /* for i (each object in options traversal table) */
+ } /* for ifil (each user-defined filter) */
+ } /* for i (each object in options traversal table) */
done:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
if (travt)
trav_table_free(travt);
return ret_value;
@@ -891,4 +899,3 @@ get_sfilter(H5Z_filter_t filtn)
else
return "UD";
} /* end get_sfilter() */
-
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index a8207b5..09f82fc 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -11,7 +11,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
#ifndef H5REPACK_H__
#define H5REPACK_H__
@@ -19,21 +18,20 @@
#include "hdf5.h"
#include "h5trav.h"
-#define H5FOPENERROR "unable to open file"
-#define PFORMAT "%-7s %-7s %-7s\n" /* chunk info, compression info, name*/
-#define PFORMAT1 "%-7s %-7s %-7s" /* chunk info, compression info, name*/
-#define MAX_NC_NAME 256 /* max length of a name */
-#define MAX_VAR_DIMS 32 /* max per variable dimensions */
-#define FORMAT_OBJ " %-27s %s\n" /* obj type, name */
-#define FORMAT_OBJ_ATTR " %-27s %s\n" /* obj type, name */
-#define MAX_COMPACT_DSIZE 64512 /* max data size for compact layout. -1k for header size */
+#define H5FOPENERROR "unable to open file"
+#define PFORMAT "%-7s %-7s %-7s\n" /* chunk info, compression info, name*/
+#define PFORMAT1 "%-7s %-7s %-7s" /* chunk info, compression info, name*/
+#define MAX_NC_NAME 256 /* max length of a name */
+#define MAX_VAR_DIMS 32 /* max per variable dimensions */
+#define FORMAT_OBJ " %-27s %s\n" /* obj type, name */
+#define FORMAT_OBJ_ATTR " %-27s %s\n" /* obj type, name */
+#define MAX_COMPACT_DSIZE 64512 /* max data size for compact layout. -1k for header size */
/* File space default information */
-#define FS_PAGESIZE_DEF 4096
-#define FS_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
-#define FS_PERSIST_DEF FALSE
-#define FS_THRESHOLD_DEF 1
-
+#define FS_PAGESIZE_DEF 4096
+#define FS_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
+#define FS_PERSIST_DEF FALSE
+#define FS_THRESHOLD_DEF 1
/*-------------------------------------------------------------------------
* data structures for command line options
@@ -42,7 +40,7 @@
/* a list of names */
typedef struct {
- char obj[MAX_NC_NAME];
+ char obj[MAX_NC_NAME];
} obj_list_t;
/*
@@ -60,16 +58,16 @@ typedef struct {
#define CD_VALUES 20
typedef struct {
- H5Z_filter_t filtn; /* filter identification number */
- unsigned filt_flag; /* filter definition flag */
- unsigned cd_values[CD_VALUES]; /* filter client data values */
- size_t cd_nelmts; /* filter client number of values */
+ H5Z_filter_t filtn; /* filter identification number */
+ unsigned filt_flag; /* filter definition flag */
+ unsigned cd_values[CD_VALUES]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
} filter_info_t;
/* chunk lengths along each dimension and rank */
typedef struct {
- hsize_t chunk_lengths[MAX_VAR_DIMS];
- int rank;
+ hsize_t chunk_lengths[MAX_VAR_DIMS];
+ int rank;
} chunk_info_t;
/* we currently define a maximum value for the filters array,
@@ -78,22 +76,21 @@ typedef struct {
/* information for one object, contains PATH, CHUNK info and FILTER info */
typedef struct {
- char path[MAX_NC_NAME]; /* name of object */
- filter_info_t filter[H5_REPACK_MAX_NFILTERS]; /* filter array */
- int nfilters; /* current number of filters */
- H5D_layout_t layout; /* layout information */
- chunk_info_t chunk; /* chunk information */
- hid_t refobj_id; /* object ID, references */
+ char path[MAX_NC_NAME]; /* name of object */
+ filter_info_t filter[H5_REPACK_MAX_NFILTERS]; /* filter array */
+ int nfilters; /* current number of filters */
+ H5D_layout_t layout; /* layout information */
+ chunk_info_t chunk; /* chunk information */
+ hid_t refobj_id; /* object ID, references */
} pack_info_t;
/* store a table of all objects */
typedef struct {
- unsigned int size;
- unsigned int nelems;
- pack_info_t *objs;
+ unsigned int size;
+ unsigned int nelems;
+ pack_info_t *objs;
} pack_opttbl_t;
-
/*-------------------------------------------------------------------------
* command line options
*-------------------------------------------------------------------------
@@ -101,43 +98,42 @@ typedef struct {
/* all the above, ready to go to the hrepack call */
typedef struct {
- pack_opttbl_t *op_tbl; /* table with all -c and -f options */
- int all_layout; /* apply the layout to all objects */
- int all_filter; /* apply the filter to all objects */
- filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */
- int n_filter_g; /* number of global filters */
- chunk_info_t chunk_g; /* global chunk INFO for the ALL case */
- H5D_layout_t layout_g; /* global layout information for the ALL case */
- int verbose; /* verbose mode */
- hbool_t merge; /* Merge external file. */
- hbool_t prune; /* Don't follow external file. */
- hsize_t min_comp; /* minimum size to compress, in bytes */
- int use_native; /* use a native type in write */
- hbool_t latest; /* pack file with the latest file format */
- H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */
- H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */
- hid_t fin_fapl; /* FAPL to use for opening the input file */
- hid_t fout_fapl; /* FAPL to use for opening/creating the output file */
- int grp_compact; /* Set the maximum number of links to store as header messages in the group */
- int grp_indexed; /* Set the minimum number of links to store in the indexed format */
- int msg_size[8]; /* Minimum size of shared messages: dataspace,
- datatype, fill value, filter pipleline, attribute */
- const char *ublock_filename; /* user block file name */
- hsize_t ublock_size; /* user block size */
- hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
- hsize_t threshold; /* alignment threshold for H5Pset_alignment */
- hsize_t alignment; /* alignment for H5Pset_alignment */
- H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
- int fs_persist; /* Free space section threshold */
- long fs_threshold; /* Free space section threshold */
- long long fs_pagesize; /* File space page size */
+ pack_opttbl_t *op_tbl; /* table with all -c and -f options */
+ int all_layout; /* apply the layout to all objects */
+ int all_filter; /* apply the filter to all objects */
+ filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */
+ int n_filter_g; /* number of global filters */
+ chunk_info_t chunk_g; /* global chunk INFO for the ALL case */
+ H5D_layout_t layout_g; /* global layout information for the ALL case */
+ int verbose; /* verbose mode */
+ hbool_t merge; /* Merge external file. */
+ hbool_t prune; /* Don't follow external file. */
+ hsize_t min_comp; /* minimum size to compress, in bytes */
+ int use_native; /* use a native type in write */
+ hbool_t latest; /* pack file with the latest file format */
+ H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */
+ H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */
+ hid_t fin_fapl; /* FAPL to use for opening the input file */
+ hid_t fout_fapl; /* FAPL to use for opening/creating the output file */
+ int grp_compact; /* Set the maximum number of links to store as header messages in the group */
+ int grp_indexed; /* Set the minimum number of links to store in the indexed format */
+ int msg_size[8]; /* Minimum size of shared messages: dataspace,
+ datatype, fill value, filter pipleline, attribute */
+ const char * ublock_filename; /* user block file name */
+ hsize_t ublock_size; /* user block size */
+ hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
+ hsize_t threshold; /* alignment threshold for H5Pset_alignment */
+ hsize_t alignment; /* alignment for H5Pset_alignment */
+ H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
+ int fs_persist; /* Free space section threshold */
+ long fs_threshold; /* Free space section threshold */
+ long long fs_pagesize; /* File space page size */
} pack_opt_t;
-
typedef struct named_dt_t {
- haddr_t addr_in; /* Address of the named dtype in the in file */
- hid_t id_out; /* Open identifier for the dtype in the out file */
- struct named_dt_t *next; /* Next dtype */
+ haddr_t addr_in; /* Address of the named dtype in the in file */
+ hid_t id_out; /* Open identifier for the dtype in the out file */
+ struct named_dt_t *next; /* Next dtype */
} named_dt_t;
/*-------------------------------------------------------------------------
@@ -149,9 +145,9 @@ typedef struct named_dt_t {
extern "C" {
#endif
-int h5repack(const char* infile, const char* outfile, pack_opt_t *options);
-int h5repack_addfilter(const char* str, pack_opt_t *options);
-int h5repack_addlayout(const char* str, pack_opt_t *options);
+int h5repack(const char *infile, const char *outfile, pack_opt_t *options);
+int h5repack_addfilter(const char *str, pack_opt_t *options);
+int h5repack_addlayout(const char *str, pack_opt_t *options);
int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest);
int h5repack_end(pack_opt_t *options);
int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options);
@@ -164,36 +160,29 @@ int h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, h
* However copy_attr() may be obsoleted when H5Acopy is available and put back
* others to static in h5repack_copy.c.
*/
-hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options);
-int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err);
-int copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
- trav_table_t *travt, pack_opt_t *options);
+hid_t copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt,
+ pack_opt_t *options);
+int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err);
+int copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_t *travt,
+ pack_opt_t *options);
#ifdef __cplusplus
}
#endif
-
-
/*-------------------------------------------------------------------------
* private functions
*-------------------------------------------------------------------------
*/
-
/*-------------------------------------------------------------------------
* copy module
*-------------------------------------------------------------------------
*/
-int copy_objects (const char* fnamein,
- const char* fnameout,
- pack_opt_t *options);
+int copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options);
-int do_copy_refobjs(hid_t fidin,
- hid_t fidout,
- trav_table_t *travt,
- pack_opt_t *options);
+int do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options);
/*-------------------------------------------------------------------------
* filters and verify module
@@ -201,56 +190,38 @@ int do_copy_refobjs(hid_t fidin,
*/
void init_packobject(pack_info_t *obj);
-
/*-------------------------------------------------------------------------
* filters and copy module
*-------------------------------------------------------------------------
*/
-int apply_filters(const char* name, /* object name from traverse list */
- int rank, /* rank of dataset */
- hsize_t *dims, /* dimensions of dataset */
- size_t msize, /* size of type */
- hid_t dcpl_id, /* dataset creation property list */
+int apply_filters(const char *name, /* object name from traverse list */
+ int rank, /* rank of dataset */
+ hsize_t * dims, /* dimensions of dataset */
+ size_t msize, /* size of type */
+ hid_t dcpl_id, /* dataset creation property list */
pack_opt_t *options, /* repack options */
- int *has_filter); /* (OUT) object NAME has a filter */
-
+ int * has_filter); /* (OUT) object NAME has a filter */
/*-------------------------------------------------------------------------
* options table
*-------------------------------------------------------------------------
*/
-int options_table_init(pack_opttbl_t **tbl);
-int options_table_free(pack_opttbl_t *table);
-int options_add_layout(obj_list_t *obj_list,
- unsigned n_objs,
- pack_info_t *pack,
- pack_opttbl_t *table);
-int options_add_filter(obj_list_t *obj_list,
- unsigned n_objs,
- filter_info_t filt,
- pack_opttbl_t *table);
-pack_info_t* options_get_object(const char *path,
- pack_opttbl_t *table);
+int options_table_init(pack_opttbl_t **tbl);
+int options_table_free(pack_opttbl_t *table);
+int options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pack_opttbl_t *table);
+int options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pack_opttbl_t *table);
+pack_info_t *options_get_object(const char *path, pack_opttbl_t *table);
/*-------------------------------------------------------------------------
* parse functions
*-------------------------------------------------------------------------
*/
-obj_list_t* parse_filter(const char *str,
- unsigned *n_objs,
- filter_info_t *filt,
- pack_opt_t *options,
+obj_list_t *parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t *options,
int *is_glb);
-obj_list_t* parse_layout(const char *str,
- unsigned *n_objs,
- pack_info_t *pack, /* info about object */
+obj_list_t *parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about object */
pack_opt_t *options);
-
-
-
-#endif /* H5REPACK_H__ */
-
+#endif /* H5REPACK_H__ */
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 4d330d1..a71f658 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -31,24 +31,21 @@
*/
/* size of buffer/# of bytes to xfer at a time when copying userblock */
-#define USERBLOCK_XFER_SIZE 512
+#define USERBLOCK_XFER_SIZE 512
/*-------------------------------------------------------------------------
* local functions
*-------------------------------------------------------------------------
*/
-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 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,
- pack_opt_t *options);
-static int copy_user_block(const char *infile, const char *outfile,
- hsize_t size);
-#if defined (H5REPACK_DEBUG_USER_BLOCK)
+static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options);
+static int copy_user_block(const char *infile, const char *outfile, hsize_t size);
+#if defined(H5REPACK_DEBUG_USER_BLOCK)
static void print_user_block(const char *filename, hid_t fid);
#endif
-
/*-------------------------------------------------------------------------
* Function: copy_objects
*
@@ -59,33 +56,33 @@ static void print_user_block(const char *filename, hid_t fid);
*-------------------------------------------------------------------------
*/
int
-copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
+copy_objects(const char *fnamein, const char *fnameout, pack_opt_t *options)
{
- hid_t fidin = H5I_INVALID_HID;
- hid_t fidout = H5I_INVALID_HID;
- hid_t fcpl_in = H5I_INVALID_HID; /* file creation property list ID for input file */
- hid_t grp_in = H5I_INVALID_HID; /* group ID */
- hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
- hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
- trav_table_t *travt = NULL;
- hsize_t ub_size = 0; /* size of user block */
- H5F_fspace_strategy_t set_strategy; /* Strategy to be set in outupt file */
- hbool_t set_persist; /* Persist free-space status to be set in output file */
- hsize_t set_threshold; /* Free-space section threshold to be set in output file */
- hsize_t set_pagesize; /* File space page size to be set in output file */
- H5F_fspace_strategy_t in_strategy; /* Strategy from input file */
- hbool_t in_persist; /* Persist free-space status from input file */
- hsize_t in_threshold; /* Free-space section threshold from input file */
- hsize_t in_pagesize; /* File space page size from input file */
- unsigned crt_order_flags; /* group creation order flag */
- int ret_value = 0;
+ hid_t fidin = H5I_INVALID_HID;
+ hid_t fidout = H5I_INVALID_HID;
+ hid_t fcpl_in = H5I_INVALID_HID; /* file creation property list ID for input file */
+ hid_t grp_in = H5I_INVALID_HID; /* group ID */
+ hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
+ hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
+ trav_table_t * travt = NULL;
+ hsize_t ub_size = 0; /* size of user block */
+ H5F_fspace_strategy_t set_strategy; /* Strategy to be set in outupt file */
+ hbool_t set_persist; /* Persist free-space status to be set in output file */
+ hsize_t set_threshold; /* Free-space section threshold to be set in output file */
+ hsize_t set_pagesize; /* File space page size to be set in output file */
+ H5F_fspace_strategy_t in_strategy; /* Strategy from input file */
+ hbool_t in_persist; /* Persist free-space status from input file */
+ hsize_t in_threshold; /* Free-space section threshold from input file */
+ hsize_t in_pagesize; /* File space page size from input file */
+ unsigned crt_order_flags; /* group creation order flag */
+ int ret_value = 0;
/*-------------------------------------------------------------------------
* open input file
*-------------------------------------------------------------------------
*/
if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, options->fin_fapl,
- (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, (size_t) 0)) < 0)
+ (options->fin_fapl == H5P_DEFAULT) ? FALSE : TRUE, NULL, (size_t)0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR);
/* get user block size and file space strategy/persist/threshold */
@@ -97,11 +94,11 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_userblock failed to retrieve userblock size");
/* If the -S option is not set, get "strategy" from the input file */
- if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0)
+ if (H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_strategy failed to retrieve file space strategy");
/* If the -G option is not set, get "pagesize" from the input file */
- if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0)
+ if (H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_page_size failed to retrieve file space threshold");
/* open root group */
@@ -120,7 +117,7 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed to close property list");
}
- if(options->latest)
+ if (options->latest)
options->low_bound = options->high_bound = H5F_LIBVER_LATEST;
/* Create file access property list */
@@ -129,7 +126,7 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create file access property list");
/* It can be default, latest or other settings by users */
- if(H5Pset_libver_bounds(options->fout_fapl, options->low_bound, options->high_bound) < 0)
+ if (H5Pset_libver_bounds(options->fout_fapl, options->low_bound, options->high_bound) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_libver_bounds failed to set format version bounds");
/* Check if we need to create a non-default file creation property list */
@@ -147,8 +144,11 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
/* Adjust group creation parameters for root group */
/* (So that it is created in "dense storage" form) */
- if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_phase_change failed to adjust group creation parameters for root group");
+ if (H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact,
+ (unsigned)options->grp_indexed) < 0)
+ H5TOOLS_GOTO_ERROR(
+ (-1),
+ "H5Pset_link_phase_change failed to adjust group creation parameters for root group");
for (i = 0; i < 5; i++) {
if (options->msg_size[i] > 0) {
@@ -176,26 +176,28 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
default:
break;
} /* end switch */
- min_mesg_sizes[nindex] = (unsigned) options->msg_size[i];
+ min_mesg_sizes[nindex] = (unsigned)options->msg_size[i];
nindex++;
} /* end if */
- } /* end for */
+ } /* end for */
if (nindex > 0) {
if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_shared_mesg_nindexes failed to set the number of shared object header message indexes");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_shared_mesg_nindexes failed to set the number of shared "
+ "object header message indexes");
/* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */
for (i = 0; i < (nindex - 1); i++)
if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_shared_mesg_index failed to configure the specified shared object header message index");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_shared_mesg_index failed to configure the specified "
+ "shared object header message index");
} /* if (nindex>0) */
} /* end if */
- } /* end if */
-#if defined (H5REPACK_DEBUG_USER_BLOCK)
-print_user_block(fnamein, fidin);
+ } /* end if */
+#if defined(H5REPACK_DEBUG_USER_BLOCK)
+ print_user_block(fnamein, fidin);
#endif
/*-------------------------------------------------------------------------
@@ -255,41 +257,41 @@ print_user_block(fnamein, fidin);
if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed to create a file creation property list");
- if(H5Pset_link_creation_order(fcpl, crt_order_flags ) < 0)
+ if (H5Pset_link_creation_order(fcpl, crt_order_flags) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_creation_order failed");
/* Set file space info to those from input file */
- set_strategy = in_strategy;
- set_persist = in_persist;
+ set_strategy = in_strategy;
+ set_persist = in_persist;
set_threshold = in_threshold;
- set_pagesize = in_pagesize;
+ set_pagesize = in_pagesize;
- if(options->fs_strategy == (H5F_fspace_strategy_t)-1) /* A default strategy is specified by user */
+ if (options->fs_strategy == (H5F_fspace_strategy_t)-1) /* A default strategy is specified by user */
set_strategy = FS_STRATEGY_DEF;
- else if(options->fs_strategy != (H5F_fspace_strategy_t)0) /* Set strategy as specified by user */
+ else if (options->fs_strategy != (H5F_fspace_strategy_t)0) /* Set strategy as specified by user */
set_strategy = options->fs_strategy;
- if(options->fs_persist == -1) /* A default "persist" is specified by user */
+ if (options->fs_persist == -1) /* A default "persist" is specified by user */
set_persist = FS_PERSIST_DEF;
- else if(options->fs_persist != 0) /* Set "persist" as specified by user */
+ else if (options->fs_persist != 0) /* Set "persist" as specified by user */
set_persist = (hbool_t)options->fs_persist;
- if(options->fs_threshold == -1) /* A "0" threshold is specified by user */
+ if (options->fs_threshold == -1) /* A "0" threshold is specified by user */
set_threshold = (hsize_t)0;
- else if(options->fs_threshold != 0) /* Set threshold as specified by user */
+ else if (options->fs_threshold != 0) /* Set threshold as specified by user */
set_threshold = (hsize_t)options->fs_threshold;
/* Set file space information as specified */
- if(H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0)
+ if (H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_file_space_strategy failed to set file space strategy");
- if(options->fs_pagesize == -1) /* A "0" file space page size is specified by user */
+ if (options->fs_pagesize == -1) /* A "0" file space page size is specified by user */
set_pagesize = (hsize_t)0;
- else if(options->fs_pagesize != 0) /* Set file space page size as specified by user */
+ else if (options->fs_pagesize != 0) /* Set file space page size as specified by user */
set_pagesize = (hsize_t)options->fs_pagesize;
- if(set_pagesize != FS_PAGESIZE_DEF) /* Set non-default file space page size as specified */
- if(H5Pset_file_space_page_size(fcpl, set_pagesize) < 0)
+ if (set_pagesize != FS_PAGESIZE_DEF) /* Set non-default file space page size as specified */
+ if (H5Pset_file_space_page_size(fcpl, set_pagesize) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_file_space_page_size failed to set file space page size");
/*-------------------------------------------------------------------------
@@ -326,19 +328,21 @@ print_user_block(fnamein, fidin);
H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed");
/*-------------------------------------------------------------------------
- * do the copy
- *-------------------------------------------------------------------------
- */
+ * do the copy
+ *-------------------------------------------------------------------------
+ */
if (do_copy_objects(fidin, fidout, travt, options) < 0)
- H5TOOLS_GOTO_ERROR((-1), "do_copy_objects from <%s> could not copy data to <%s>", fnamein, fnameout);
+ H5TOOLS_GOTO_ERROR((-1), "do_copy_objects from <%s> could not copy data to <%s>", fnamein,
+ fnameout);
/*-------------------------------------------------------------------------
- * do the copy of referenced objects
- * and create hard links
- *-------------------------------------------------------------------------
- */
+ * do the copy of referenced objects
+ * and create hard links
+ *-------------------------------------------------------------------------
+ */
if (do_copy_refobjs(fidin, fidout, travt, options) < 0)
- H5TOOLS_GOTO_ERROR((-1), "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein, fnameout);
+ H5TOOLS_GOTO_ERROR((-1), "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein,
+ fnameout);
}
/*-------------------------------------------------------------------------
@@ -351,7 +355,8 @@ print_user_block(fnamein, fidin);
H5TOOLS_GOTO_ERROR((-1), "Could not copy user block. Exiting...");
done:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fcpl_in);
H5Pclose(gcpl_in);
H5Pclose(fcpl);
@@ -360,7 +365,8 @@ done:
H5Fclose(fidout);
H5Fclose(fidin);
H5Fclose(fidout);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
if (travt)
trav_table_free(travt);
@@ -400,20 +406,20 @@ done:
*-----------------------------------------*/
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)
+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 k;
+ int k;
H5D_layout_t dset_layout;
- int rank_chunk;
- hsize_t dims_chunk[H5S_MAX_RANK];
- hsize_t size_chunk = 1;
- hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
- hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
- hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */
- hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
- hsize_t hslab_nbytes; /* size of hyperslab in byte */
- int ret_value = 0;
+ int rank_chunk;
+ hsize_t dims_chunk[H5S_MAX_RANK];
+ hsize_t size_chunk = 1;
+ hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
+ hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
+ hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */
+ hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
+ hsize_t hslab_nbytes; /* size of hyperslab in byte */
+ int ret_value = 0;
/* init to set as size of a data element */
hslab_nbytes = size_datum;
@@ -452,7 +458,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
chunk_dims_map[k - 1]++;
/* get mapped hyperslab dims */
- hs_dims_map[k - 1] = MIN (nchunk_fit, chunk_dims_map[k-1]);
+ hs_dims_map[k - 1] = MIN(nchunk_fit, chunk_dims_map[k - 1]);
/* prepare next round */
nchunk_fit = nchunk_fit / chunk_dims_map[k - 1];
@@ -461,7 +467,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
nchunk_fit = 1;
/* get hyperslab dimentions as unmapping to actual size */
- dims_hslab[k - 1] = MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]);
+ dims_hslab[k - 1] = MIN((hs_dims_map[k - 1] * dims_chunk[k - 1]), dims_dset[k - 1]);
/* calculate total size for the hyperslab */
hslab_nbytes *= dims_hslab[k - 1];
@@ -482,7 +488,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
if (ndatum_fit == 0)
ndatum_fit = 1;
/* get hyperslab dimentions within a chunk boundary */
- dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit);
+ dims_hslab[k - 1] = MIN(dims_chunk[k - 1], ndatum_fit);
/* calculate total size for the hyperslab */
hslab_nbytes *= dims_hslab[k - 1];
@@ -578,49 +584,48 @@ done:
*/
int
-do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
- pack_opt_t *options) /* repack options */
+do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options) /* repack options */
{
- hid_t grp_in = H5I_INVALID_HID; /* group ID */
- hid_t grp_out = H5I_INVALID_HID; /* group ID */
- hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */
- hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */
- hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
- hid_t gcpl_out = H5I_INVALID_HID; /* group creation property list */
- hid_t type_in = H5I_INVALID_HID; /* named type ID */
- hid_t type_out = H5I_INVALID_HID; /* named type ID */
- hid_t dcpl_in = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t dcpl_out = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t f_space_id = H5I_INVALID_HID; /* file space ID */
- hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
- hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
- hid_t ocpl_id = H5I_INVALID_HID; /* property to pass copy options */
- hid_t lcpl_id = H5I_INVALID_HID; /* link creation property list */
- named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
- size_t msize; /* size of type */
- hsize_t nelmts; /* number of elements in dataset */
- H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */
- int rank; /* rank of dataset */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
- hsize_t dsize_in; /* input dataset size before filter */
- hsize_t dsize_out; /* output dataset size after filter */
- int apply_s; /* flag for apply filter to small dataset sizes */
- int apply_f; /* flag for apply filter to return error on H5Dcreate */
- void *buf = NULL; /* buffer for raw data */
- void *hslab_buf = NULL; /* hyperslab buffer for raw data */
- int has_filter; /* current object has a filter */
- int req_filter; /* there was a request for a filter */
- int req_obj_layout = 0; /* request layout to current object */
- unsigned crt_order_flags; /* group creation order flag */
+ hid_t grp_in = H5I_INVALID_HID; /* group ID */
+ hid_t grp_out = H5I_INVALID_HID; /* group ID */
+ hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */
+ hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */
+ hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
+ hid_t gcpl_out = H5I_INVALID_HID; /* group creation property list */
+ hid_t type_in = H5I_INVALID_HID; /* named type ID */
+ hid_t type_out = H5I_INVALID_HID; /* named type ID */
+ hid_t dcpl_in = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t dcpl_out = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t f_space_id = H5I_INVALID_HID; /* file space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
+ hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
+ hid_t ocpl_id = H5I_INVALID_HID; /* property to pass copy options */
+ hid_t lcpl_id = H5I_INVALID_HID; /* link creation property list */
+ named_dt_t * named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
+ size_t msize; /* size of type */
+ hsize_t nelmts; /* number of elements in dataset */
+ H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */
+ int rank; /* rank of dataset */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
+ hsize_t dsize_in; /* input dataset size before filter */
+ hsize_t dsize_out; /* output dataset size after filter */
+ int apply_s; /* flag for apply filter to small dataset sizes */
+ int apply_f; /* flag for apply filter to return error on H5Dcreate */
+ void * buf = NULL; /* buffer for raw data */
+ void * hslab_buf = NULL; /* hyperslab buffer for raw data */
+ int has_filter; /* current object has a filter */
+ int req_filter; /* there was a request for a filter */
+ int req_obj_layout = 0; /* request layout to current object */
+ unsigned crt_order_flags; /* group creation order flag */
h5tool_link_info_t linkinfo;
- unsigned i;
- unsigned u;
- int ifil;
- int is_ref = 0;
- htri_t is_named;
- hbool_t limit_maxdims;
- hsize_t size_dset;
- int ret_value = 0;
+ unsigned i;
+ unsigned u;
+ int ifil;
+ int is_ref = 0;
+ htri_t is_named;
+ hbool_t limit_maxdims;
+ hsize_t size_dset;
+ int ret_value = 0;
/* init linkinfo struct */
HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t));
@@ -639,625 +644,654 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
if (travt->objs) {
for (i = 0; i < travt->nobjs; i++) {
/* init variables per obj */
- buf = NULL;
+ buf = NULL;
limit_maxdims = FALSE;
switch (travt->objs[i].type) {
- case H5TRAV_TYPE_UNKNOWN:
- break;
-
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_GROUP
- *-------------------------------------------------------------------------
- */
- case H5TRAV_TYPE_GROUP:
- if (options->verbose)
- HDprintf(FORMAT_OBJ, "group", travt->objs[i].name);
+ case H5TRAV_TYPE_UNKNOWN:
+ break;
- /* open input group */
- if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed");
-
- /* get input group creation property list */
- if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Gget_create_plist failed");
-
- /* query and set the group creation properties */
- if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pget_link_creation_order failed");
-
- /* set up group creation property list */
- if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
-
- if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_creation_order failed");
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_GROUP
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_GROUP:
+ if (options->verbose)
+ HDprintf(FORMAT_OBJ, "group", travt->objs[i].name);
- /*-------------------------------------------------------------------------
- * the root is a special case, we get an ID for the root group
- * and copy its attributes using that ID
- *-------------------------------------------------------------------------
- */
- if (HDstrcmp(travt->objs[i].name, "/") == 0) {
- if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0)
+ /* open input group */
+ if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed");
- }
- else {
- if (options->grp_compact > 0 || options->grp_indexed > 0)
- if (H5Pset_link_phase_change(gcpl_out, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_phase_change failed");
-
- if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Gcreate2 failed");
- }
- /*-------------------------------------------------------------------------
- * copy attrs
- *-------------------------------------------------------------------------
- */
- if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0)
- H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
-
- if (H5Pclose(gcpl_out) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if (H5Pclose(gcpl_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if (H5Gclose(grp_out) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
- if (H5Gclose(grp_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
+ /* get input group creation property list */
+ if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Gget_create_plist failed");
- break;
+ /* query and set the group creation properties */
+ if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pget_link_creation_order failed");
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_DATASET
- *-------------------------------------------------------------------------
- */
- case H5TRAV_TYPE_DATASET:
- {
- hbool_t use_h5ocopy;
-
- has_filter = 0;
- req_filter = 0;
-
- /* check if global filters were requested */
- if (options->n_filter_g)
- req_filter = 1;
-
- /* check if filters were requested for individual objects */
- if (options->op_tbl->objs) {
- for (u = 0; u < options->op_tbl->nelems; u++) {
- if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0)
- for (ifil = 0; ifil < options->op_tbl->objs[ifil].nfilters; ifil++) {
- if (options->op_tbl->objs[u].filter[ifil].filtn > 0)
- req_filter = 1;
- }
- }
- }
+ /* set up group creation property list */
+ if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
- /* check if layout change requested individual object */
- if (options->layout_g != H5D_LAYOUT_ERROR) {
- pack_info_t *pckinfo;
+ if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_creation_order failed");
- /* any dataset is specified */
- if (options->op_tbl->nelems > 0) {
- /* check if object exist */
- pckinfo = options_get_object(travt->objs[i].name, options->op_tbl);
- if (pckinfo)
- req_obj_layout = 1;
+ /*-------------------------------------------------------------------------
+ * the root is a special case, we get an ID for the root group
+ * and copy its attributes using that ID
+ *-------------------------------------------------------------------------
+ */
+ if (HDstrcmp(travt->objs[i].name, "/") == 0) {
+ if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed");
+ }
+ else {
+ if (options->grp_compact > 0 || options->grp_indexed > 0)
+ if (H5Pset_link_phase_change(gcpl_out, (unsigned)options->grp_compact,
+ (unsigned)options->grp_indexed) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_link_phase_change failed");
+
+ if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out,
+ H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Gcreate2 failed");
}
- }
- /* early detection of references */
- if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
- if ((ftype_id = H5Dget_type(dset_in)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
- if (H5T_REFERENCE == H5Tget_class(ftype_id))
- is_ref = 1;
-
- /* Check if the datatype is committed */
- if ((is_named = H5Tcommitted(ftype_id)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tcommitted failed");
- if (is_named)
- if ((wtype_id = copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "copy_named_datatype failed");
+ /*-------------------------------------------------------------------------
+ * copy attrs
+ *-------------------------------------------------------------------------
+ */
+ if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
+
+ if (H5Pclose(gcpl_out) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ if (H5Pclose(gcpl_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ if (H5Gclose(grp_out) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
+ if (H5Gclose(grp_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
- if (H5Tclose(ftype_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if (H5Dclose(dset_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
+ break;
/*-------------------------------------------------------------------------
- * check if we should use H5Ocopy or not
- * if there is a request for filters/layout, we read/write the object
- * otherwise we do a copy using H5Ocopy
+ * H5TRAV_TYPE_DATASET
*-------------------------------------------------------------------------
*/
- use_h5ocopy = !(options->op_tbl->nelems || options->all_filter == 1
- || options->all_layout == 1 || is_ref || is_named);
+ case H5TRAV_TYPE_DATASET: {
+ hbool_t use_h5ocopy;
+
+ has_filter = 0;
+ req_filter = 0;
+
+ /* check if global filters were requested */
+ if (options->n_filter_g)
+ req_filter = 1;
+
+ /* check if filters were requested for individual objects */
+ if (options->op_tbl->objs) {
+ for (u = 0; u < options->op_tbl->nelems; u++) {
+ if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0)
+ for (ifil = 0; ifil < options->op_tbl->objs[ifil].nfilters; ifil++) {
+ if (options->op_tbl->objs[u].filter[ifil].filtn > 0)
+ req_filter = 1;
+ }
+ }
+ }
+
+ /* check if layout change requested individual object */
+ if (options->layout_g != H5D_LAYOUT_ERROR) {
+ pack_info_t *pckinfo;
- if (!use_h5ocopy) {
- int j;
+ /* any dataset is specified */
+ if (options->op_tbl->nelems > 0) {
+ /* check if object exist */
+ pckinfo = options_get_object(travt->objs[i].name, options->op_tbl);
+ if (pckinfo)
+ req_obj_layout = 1;
+ }
+ }
+ /* early detection of references */
if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
- if ((f_space_id = H5Dget_space(dset_in)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
if ((ftype_id = H5Dget_type(dset_in)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
- if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
- if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_ndims failed");
- HDmemset(dims, 0, sizeof dims);
- if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed");
- if (H5Dget_space_status(dset_in, &space_status) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dget_space_status failed");
-
- /* If the input dataset has external storage, it must be contiguous.
- * Accordingly, there would be no filter or chunk properties to preserve,
- * so create a new DCPL.
- * Otherwise, copy dcpl_in.
- */
- if (H5Pget_external_count(dcpl_in)) {
- if ((dcpl_out = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
- }
- else if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) {
- H5TOOLS_GOTO_ERROR((-1), "H5Pcopy failed");
- }
-
- nelmts = 1;
- for (j = 0; j < rank; j++)
- nelmts *= dims[j];
-
- /* wtype_id will have already been set if using a named dtype */
- if (!is_named) {
- if (options->use_native == 1)
- wtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT);
- else
- wtype_id = H5Tcopy(ftype_id);
- }
+ if (H5T_REFERENCE == H5Tget_class(ftype_id))
+ is_ref = 1;
- if ((msize = H5Tget_size(wtype_id)) == 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed");
+ /* Check if the datatype is committed */
+ if ((is_named = H5Tcommitted(ftype_id)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tcommitted failed");
+ if (is_named)
+ if ((wtype_id =
+ copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "copy_named_datatype failed");
- /* size of current dset */
- size_dset = nelmts * msize;
+ if (H5Tclose(ftype_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ if (H5Dclose(dset_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
/*-------------------------------------------------------------------------
- * check if the dataset creation property list has filters that
- * are not registered in the current configuration
- * 1) the external filters GZIP and SZIP might not be available
- * 2) the internal filters might be turned off
+ * check if we should use H5Ocopy or not
+ * if there is a request for filters/layout, we read/write the object
+ * otherwise we do a copy using H5Ocopy
*-------------------------------------------------------------------------
*/
- if (h5tools_canreadf((travt->objs[i].name), dcpl_in) == 1) {
- apply_s = 1;
- apply_f = 1;
-
- /*-------------------------------------------------------------------------
- * references are a special case
- * we cannot just copy the buffers, but instead we recreate the reference
- * in a second traversal of the output file
- *-------------------------------------------------------------------------
+ use_h5ocopy = !(options->op_tbl->nelems || options->all_filter == 1 ||
+ options->all_layout == 1 || is_ref || is_named);
+
+ if (!use_h5ocopy) {
+ int j;
+
+ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
+ if ((f_space_id = H5Dget_space(dset_in)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
+ if ((ftype_id = H5Dget_type(dset_in)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
+ if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
+ if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_ndims failed");
+ HDmemset(dims, 0, sizeof dims);
+ if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed");
+ if (H5Dget_space_status(dset_in, &space_status) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dget_space_status failed");
+
+ /* If the input dataset has external storage, it must be contiguous.
+ * Accordingly, there would be no filter or chunk properties to preserve,
+ * so create a new DCPL.
+ * Otherwise, copy dcpl_in.
*/
- if (H5T_REFERENCE != H5Tget_class(wtype_id)) {
- /* get the storage size of the input dataset */
- dsize_in = H5Dget_storage_size(dset_in);
+ if (H5Pget_external_count(dcpl_in)) {
+ if ((dcpl_out = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
+ }
+ else if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) {
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcopy failed");
+ }
- /* check for small size datasets (less than 1k) except
- * changing to COMPACT. For the reference, COMPACT is limited
- * by size 64K by library.
- */
- if (options->layout_g != H5D_COMPACT)
- if (size_dset < options->min_comp)
- apply_s = 0;
-
- /* apply the filter */
- if (apply_s)
- if (apply_filters(travt->objs[i].name, rank, dims, msize, dcpl_out, options, &has_filter) < 0)
- H5TOOLS_GOTO_ERROR((-1), "apply_filters failed");
-
- /* only if layout change requested for entire file or
- * individual obj */
- if (options->all_layout > 0 || req_obj_layout == 1) {
- /*-------------------------------------------------
- * Unset the unlimited max dims if convert to other
- * than chunk layouts, because unlimited max dims
- * only can be applied to chunk layout.
- * Also perform only for targeted dataset
- * Also check for size limit to convert to compact
- *-------------------------------------------------*/
- if (options->layout_g != H5D_CHUNKED) {
- /* any dataset is specified */
- if (options->op_tbl->nelems > 0) {
- /* if current obj match specified obj */
- if (options_get_object(travt->objs[i].name, options->op_tbl))
- limit_maxdims = TRUE;
- }
- else /* no dataset is specified */
- limit_maxdims = TRUE;
+ nelmts = 1;
+ for (j = 0; j < rank; j++)
+ nelmts *= dims[j];
- /* if convert to COMPACT */
- if (options->layout_g == H5D_COMPACT)
- if (size_dset > MAX_COMPACT_DSIZE)
- limit_maxdims = FALSE;
+ /* wtype_id will have already been set if using a named dtype */
+ if (!is_named) {
+ if (options->use_native == 1)
+ wtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT);
+ else
+ wtype_id = H5Tcopy(ftype_id);
+ }
- /* unset unlimited max dims */
- if (limit_maxdims)
- H5Sset_extent_simple(f_space_id, rank, dims, NULL);
- } /* end if not chunked */
- } /* end if layout change requested for entire file or individual object */
+ if ((msize = H5Tget_size(wtype_id)) == 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed");
- /*-------------------------------------------------------------------------
- * create the output dataset;
- * disable error checking in case the dataset cannot be created with the
- * modified dcpl; in that case use the original instead
- *-------------------------------------------------------------------------
- */
- dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT);
- if (dset_out == H5I_INVALID_HID) {
- H5TOOLS_INFO("H5Dcreate2 failed");
- if (options->verbose)
- HDprintf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name);
+ /* size of current dset */
+ size_dset = nelmts * msize;
- if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dcreate2 failed");
- apply_f = 0;
- } /* end if retry dataset create */
+ /*-------------------------------------------------------------------------
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *-------------------------------------------------------------------------
+ */
+ if (h5tools_canreadf((travt->objs[i].name), dcpl_in) == 1) {
+ apply_s = 1;
+ apply_f = 1;
/*-------------------------------------------------------------------------
- * read/write
+ * references are a special case
+ * we cannot just copy the buffers, but instead we recreate the reference
+ * in a second traversal of the output file
*-------------------------------------------------------------------------
*/
- if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) {
- size_t need = (size_t)(nelmts * msize); /* bytes needed */
-
- /* have to read the whole dataset if there is only one element in the dataset */
- if (need < H5TOOLS_MALLOCSIZE)
- buf = HDmalloc(need);
-
- if (buf != NULL) {
- if(H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
- if(H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
-
- /* Check if we have VL data in the dataset's
- * datatype that must be reclaimed */
- if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
- if (H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dvlen_reclaim failed");
-
- if (buf != NULL) { /* TODO: is buf potentially released by H5Dvlen_reclaim()? */
- HDfree(buf);
- buf = NULL;
- }
- }
- else { /* possibly not enough memory, read/write by hyperslabs */
- size_t p_type_nbytes = msize; /*size of memory type */
- hsize_t p_nelmts = nelmts; /*total elements */
- hsize_t elmtno; /*counter */
- int carry; /*counter carry value */
- unsigned int vl_data = 0; /*contains VL datatypes */
-
- /* hyperslab info */
- hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */
- hsize_t hslab_nbytes; /*bytes per hyperslab */
- hsize_t hslab_nelmts; /*elements per hyperslab*/
- hid_t hslab_space; /*hyperslab data space */
-
- /* hyperslab selection info */
- hsize_t hs_sel_offset[H5S_MAX_RANK];/* selection offset */
- hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */
- hsize_t hs_select_nelmts; /* selected elements */
- hsize_t zero[8]; /*vector of zeros */
- int k;
- H5D_layout_t dset_layout;
- hid_t dcpl_tmp = H5I_INVALID_HID; /* dataset creation property list ID */
-
- /* check if we have VL data in the dataset's datatype */
- if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE)
- vl_data = TRUE;
-
- /* check first if writing dataset is chunked,
- * if so use its chunk layout for better performance. */
- dset_layout = H5Pget_layout(dcpl_out);
- if (dset_layout == H5D_CHUNKED)
- dcpl_tmp = dcpl_out; /* writing dataset */
- else {
- dset_layout = H5Pget_layout(dcpl_in);
- if (dset_layout == H5D_CHUNKED)
- dcpl_tmp = dcpl_in; /* reading dataset */
- }
+ if (H5T_REFERENCE != H5Tget_class(wtype_id)) {
+ /* get the storage size of the input dataset */
+ dsize_in = H5Dget_storage_size(dset_in);
- /* get hyperslab dims and size in byte */
- if (get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0)
- H5TOOLS_GOTO_ERROR((-1), "get_hyperslab failed");
-
- hslab_buf = HDmalloc((size_t)hslab_nbytes);
- if (hslab_buf == NULL)
- H5TOOLS_GOTO_ERROR((-1), "can't allocate space for hyperslab");
-
- hslab_nelmts = hslab_nbytes / p_type_nbytes;
- hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL);
-
- /* the hyperslab selection loop */
- HDmemset(hs_sel_offset, 0, sizeof hs_sel_offset);
- HDmemset(zero, 0, sizeof zero);
-
- for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_select_nelmts) {
- if (rank > 0) {
- /* calculate the hyperslab selections.
- * The selection would be same as the hyperslab
- * except for remaining edge portion of the dataset
- * which is smaller then the hyperslab.
- */
- for (k = 0, hs_select_nelmts = 1; k < rank; k++) {
- /* MIN() is used to get the remaining edge portion if exist.
- * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/
- hs_sel_count[k] = MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]);
- hs_select_nelmts *= hs_sel_count[k];
- }
+ /* check for small size datasets (less than 1k) except
+ * changing to COMPACT. For the reference, COMPACT is limited
+ * by size 64K by library.
+ */
+ if (options->layout_g != H5D_COMPACT)
+ if (size_dset < options->min_comp)
+ apply_s = 0;
+
+ /* apply the filter */
+ if (apply_s)
+ if (apply_filters(travt->objs[i].name, rank, dims, msize, dcpl_out,
+ options, &has_filter) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "apply_filters failed");
+
+ /* only if layout change requested for entire file or
+ * individual obj */
+ if (options->all_layout > 0 || req_obj_layout == 1) {
+ /*-------------------------------------------------
+ * Unset the unlimited max dims if convert to other
+ * than chunk layouts, because unlimited max dims
+ * only can be applied to chunk layout.
+ * Also perform only for targeted dataset
+ * Also check for size limit to convert to compact
+ *-------------------------------------------------*/
+ if (options->layout_g != H5D_CHUNKED) {
+ /* any dataset is specified */
+ if (options->op_tbl->nelems > 0) {
+ /* if current obj match specified obj */
+ if (options_get_object(travt->objs[i].name, options->op_tbl))
+ limit_maxdims = TRUE;
+ }
+ else /* no dataset is specified */
+ limit_maxdims = TRUE;
- if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_sel_offset, NULL, hs_sel_count, NULL) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Sselect_hyperslab failed");
- if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Sselect_hyperslab failed");
- } /* end if rank > 0 */
- else {
- H5Sselect_all(f_space_id);
- H5Sselect_all(hslab_space);
- hs_select_nelmts = 1;
- } /* end (else) rank == 0 */
+ /* if convert to COMPACT */
+ if (options->layout_g == H5D_COMPACT)
+ if (size_dset > MAX_COMPACT_DSIZE)
+ limit_maxdims = FALSE;
+
+ /* unset unlimited max dims */
+ if (limit_maxdims)
+ H5Sset_extent_simple(f_space_id, rank, dims, NULL);
+ } /* end if not chunked */
+ } /* end if layout change requested for entire file or individual object */
+
+ /*-------------------------------------------------------------------------
+ * create the output dataset;
+ * disable error checking in case the dataset cannot be created with the
+ * modified dcpl; in that case use the original instead
+ *-------------------------------------------------------------------------
+ */
+ dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id,
+ H5P_DEFAULT, dcpl_out, H5P_DEFAULT);
+ if (dset_out == H5I_INVALID_HID) {
+ H5TOOLS_INFO("H5Dcreate2 failed");
+ if (options->verbose)
+ HDprintf(" warning: could not create dataset <%s>. Applying original "
+ "settings\n",
+ travt->objs[i].name);
+
+ if ((dset_out =
+ H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id,
+ H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dcreate2 failed");
+ apply_f = 0;
+ } /* end if retry dataset create */
+
+ /*-------------------------------------------------------------------------
+ * read/write
+ *-------------------------------------------------------------------------
+ */
+ if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) {
+ size_t need = (size_t)(nelmts * msize); /* bytes needed */
- if(H5Dread(dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0)
+ /* have to read the whole dataset if there is only one element in the
+ * dataset */
+ if (need < H5TOOLS_MALLOCSIZE)
+ buf = HDmalloc(need);
+
+ if (buf != NULL) {
+ if (H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) <
+ 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
- if(H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0)
+ if (H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) <
+ 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
- /* reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(wtype_id, hslab_space, H5P_DEFAULT, hslab_buf);
-
- /* calculate the next hyperslab offset */
- for (k = rank, carry = 1; k > 0 && carry; --k) {
- hs_sel_offset[k - 1] += hs_sel_count[k - 1];
- /* if reached the end of a dim */
- if (hs_sel_offset[k - 1] == dims[k - 1])
- hs_sel_offset[k - 1] = 0;
- else
- carry = 0;
- }
- } /* end for (hyperslab selection loop) */
+ /* Check if we have VL data in the dataset's
+ * datatype that must be reclaimed */
+ if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
+ if (H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dvlen_reclaim failed");
- H5Sclose(hslab_space);
- if (hslab_buf != NULL) {
- HDfree(hslab_buf);
- hslab_buf = NULL;
+ if (buf != NULL) { /* TODO: is buf potentially released by
+ H5Dvlen_reclaim()? */
+ HDfree(buf);
+ buf = NULL;
+ }
}
- } /* end if reading/writing by hyperslab */
- } /* end if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) */
-
- /*-------------------------------------------------------------------------
- * print amount of compression used
- *-------------------------------------------------------------------------
- */
- if (options->verbose) {
- double ratio = 0;
-
- /* only print the compression ration if there was a filter request */
- if (apply_s && apply_f && req_filter) {
- /* get the storage size of the output dataset */
- dsize_out = H5Dget_storage_size(dset_out);
-
- /* compression ratio = uncompressed size / compressed size */
- if (dsize_out != 0)
- ratio = (double) dsize_in / (double) dsize_out;
- print_dataset_info(dcpl_out, travt->objs[i].name, ratio, 1);
- }
- else
- print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0);
+ else { /* possibly not enough memory, read/write by hyperslabs */
+ size_t p_type_nbytes = msize; /*size of memory type */
+ hsize_t p_nelmts = nelmts; /*total elements */
+ hsize_t elmtno; /*counter */
+ int carry; /*counter carry value */
+ unsigned int vl_data = 0; /*contains VL datatypes */
+
+ /* hyperslab info */
+ hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */
+ hsize_t hslab_nbytes; /*bytes per hyperslab */
+ hsize_t hslab_nelmts; /*elements per hyperslab*/
+ hid_t hslab_space; /*hyperslab data space */
+
+ /* hyperslab selection info */
+ hsize_t hs_sel_offset[H5S_MAX_RANK]; /* selection offset */
+ hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */
+ hsize_t hs_select_nelmts; /* selected elements */
+ hsize_t zero[8]; /*vector of zeros */
+ int k;
+ H5D_layout_t dset_layout;
+ hid_t dcpl_tmp =
+ H5I_INVALID_HID; /* dataset creation property list ID */
+
+ /* check if we have VL data in the dataset's datatype */
+ if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE)
+ vl_data = TRUE;
+
+ /* check first if writing dataset is chunked,
+ * if so use its chunk layout for better performance. */
+ dset_layout = H5Pget_layout(dcpl_out);
+ if (dset_layout == H5D_CHUNKED)
+ dcpl_tmp = dcpl_out; /* writing dataset */
+ else {
+ dset_layout = H5Pget_layout(dcpl_in);
+ if (dset_layout == H5D_CHUNKED)
+ dcpl_tmp = dcpl_in; /* reading dataset */
+ }
- /* print a message that the filter was not applied
- * (in case there was a filter)
- */
- if (has_filter && apply_s == 0)
- HDprintf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n", travt->objs[i].name, (int) options->min_comp);
+ /* get hyperslab dims and size in byte */
+ if (get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims,
+ &hslab_nbytes) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "get_hyperslab failed");
+
+ hslab_buf = HDmalloc((size_t)hslab_nbytes);
+ if (hslab_buf == NULL)
+ H5TOOLS_GOTO_ERROR((-1), "can't allocate space for hyperslab");
+
+ hslab_nelmts = hslab_nbytes / p_type_nbytes;
+ hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL);
+
+ /* the hyperslab selection loop */
+ HDmemset(hs_sel_offset, 0, sizeof hs_sel_offset);
+ HDmemset(zero, 0, sizeof zero);
+
+ for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_select_nelmts) {
+ if (rank > 0) {
+ /* calculate the hyperslab selections.
+ * The selection would be same as the hyperslab
+ * except for remaining edge portion of the dataset
+ * which is smaller then the hyperslab.
+ */
+ for (k = 0, hs_select_nelmts = 1; k < rank; k++) {
+ /* MIN() is used to get the remaining edge portion if
+ * exist. "dims[k] - hs_sel_offset[k]" is remaining edge
+ * portion that is smaller then the hyperslab.*/
+ hs_sel_count[k] =
+ MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]);
+ hs_select_nelmts *= hs_sel_count[k];
+ }
+
+ if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET,
+ hs_sel_offset, NULL, hs_sel_count,
+ NULL) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Sselect_hyperslab failed");
+ if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero,
+ NULL, &hs_select_nelmts, NULL) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Sselect_hyperslab failed");
+ } /* end if rank > 0 */
+ else {
+ H5Sselect_all(f_space_id);
+ H5Sselect_all(hslab_space);
+ hs_select_nelmts = 1;
+ } /* end (else) rank == 0 */
+
+ if (H5Dread(dset_in, wtype_id, hslab_space, f_space_id,
+ H5P_DEFAULT, hslab_buf) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
+ if (H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id,
+ H5P_DEFAULT, hslab_buf) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
+
+ /* reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(wtype_id, hslab_space, H5P_DEFAULT,
+ hslab_buf);
+
+ /* calculate the next hyperslab offset */
+ for (k = rank, carry = 1; k > 0 && carry; --k) {
+ hs_sel_offset[k - 1] += hs_sel_count[k - 1];
+ /* if reached the end of a dim */
+ if (hs_sel_offset[k - 1] == dims[k - 1])
+ hs_sel_offset[k - 1] = 0;
+ else
+ carry = 0;
+ }
+ } /* end for (hyperslab selection loop) */
- if (has_filter && apply_f == 0)
- HDprintf(" <warning: could not apply the filter to %s>\n", travt->objs[i].name);
- } /* end if verbose (print compression) */
+ H5Sclose(hslab_space);
+ if (hslab_buf != NULL) {
+ HDfree(hslab_buf);
+ hslab_buf = NULL;
+ }
+ } /* end if reading/writing by hyperslab */
+ } /* end if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) */
- /*-------------------------------------------------------------------------
- * copy attrs
- *-------------------------------------------------------------------------
- */
- if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
- H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
+ /*-------------------------------------------------------------------------
+ * print amount of compression used
+ *-------------------------------------------------------------------------
+ */
+ if (options->verbose) {
+ double ratio = 0;
+
+ /* only print the compression ration if there was a filter request */
+ if (apply_s && apply_f && req_filter) {
+ /* get the storage size of the output dataset */
+ dsize_out = H5Dget_storage_size(dset_out);
+
+ /* compression ratio = uncompressed size / compressed size */
+ if (dsize_out != 0)
+ ratio = (double)dsize_in / (double)dsize_out;
+ print_dataset_info(dcpl_out, travt->objs[i].name, ratio, 1);
+ }
+ else
+ print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0);
+
+ /* print a message that the filter was not applied
+ * (in case there was a filter)
+ */
+ if (has_filter && apply_s == 0)
+ HDprintf(" <warning: filter not applied to %s. dataset smaller than "
+ "%d bytes>\n",
+ travt->objs[i].name, (int)options->min_comp);
+
+ if (has_filter && apply_f == 0)
+ HDprintf(" <warning: could not apply the filter to %s>\n",
+ travt->objs[i].name);
+ } /* end if verbose (print compression) */
+
+ /*-------------------------------------------------------------------------
+ * copy attrs
+ *-------------------------------------------------------------------------
+ */
+ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
- if (H5Dclose(dset_out) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
- } /* end if not a reference */
- } /* end if h5tools_canreadf (filter availability check) */
+ if (H5Dclose(dset_out) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
+ } /* end if not a reference */
+ } /* end if h5tools_canreadf (filter availability check) */
+ /*-------------------------------------------------------------------------
+ * Close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Tclose(ftype_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ if (H5Tclose(wtype_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ if (H5Pclose(dcpl_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ if (H5Pclose(dcpl_out) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ if (H5Sclose(f_space_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
+ if (H5Dclose(dset_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
+ }
/*-------------------------------------------------------------------------
- * Close
+ * We do not have request for filter/chunking; use H5Ocopy instead
*-------------------------------------------------------------------------
*/
- if (H5Tclose(ftype_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if (H5Tclose(wtype_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if (H5Pclose(dcpl_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if (H5Pclose(dcpl_out) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if (H5Sclose(f_space_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
- if (H5Dclose(dset_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
- }
+ else {
+ /* create property to pass copy options */
+ if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
+
+ /* set options for object copy */
+ if (H5Pset_copy_object(ocpl_id, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed");
+
+ if (H5Ocopy(fidin, /* Source file or group identifier */
+ travt->objs[i].name, /* Name of the source object to be copied */
+ fidout, /* Destination file or group identifier */
+ travt->objs[i].name, /* Name of the destination object */
+ ocpl_id, /* Properties which apply to the copy */
+ H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
+ H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed");
+
+ if (H5Pclose(ocpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ ocpl_id = H5I_INVALID_HID;
+
+ /*-------------------------------------------------------------------------
+ * Copy attrs manually
+ *-------------------------------------------------------------------------
+ */
+ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
+ if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
+ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
+ if (H5Dclose(dset_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
+ if (H5Dclose(dset_out) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
+
+ if (options->verbose)
+ HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
+
+ } /* end whether we have request for filter/chunking */
+
+ break;
+ } /* H5TRAV_TYPE_DATASET */
+
/*-------------------------------------------------------------------------
- * We do not have request for filter/chunking; use H5Ocopy instead
+ * H5TRAV_TYPE_NAMED_DATATYPE
*-------------------------------------------------------------------------
*/
- else {
- /* create property to pass copy options */
- if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
+ case H5TRAV_TYPE_NAMED_DATATYPE:
+ if (options->verbose)
+ HDprintf(FORMAT_OBJ, "type", travt->objs[i].name);
- /* set options for object copy */
- if (H5Pset_copy_object(ocpl_id, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed");
+ if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Topen2 failed");
- if (H5Ocopy(fidin, /* Source file or group identifier */
- travt->objs[i].name, /* Name of the source object to be copied */
- fidout, /* Destination file or group identifier */
- travt->objs[i].name, /* Name of the destination object */
- ocpl_id, /* Properties which apply to the copy */
- H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
- H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed");
+ /* Copy the datatype anonymously */
+ if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, travt, options)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "copy_named_datatype failed");
- if (H5Pclose(ocpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- ocpl_id = H5I_INVALID_HID;
+ /* Link in to group structure */
+ if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) <
+ 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Lcreate_hard failed");
/*-------------------------------------------------------------------------
- * Copy attrs manually
+ * copy attrs
*-------------------------------------------------------------------------
*/
- if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
- if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
- if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ if (copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0)
H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
- if (H5Dclose(dset_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
- if (H5Dclose(dset_out) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
-
- if (options->verbose)
- HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
-
- } /* end whether we have request for filter/chunking */
- break;
- } /* H5TRAV_TYPE_DATASET */
-
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_NAMED_DATATYPE
- *-------------------------------------------------------------------------
- */
- case H5TRAV_TYPE_NAMED_DATATYPE:
- if (options->verbose)
- HDprintf(FORMAT_OBJ, "type", travt->objs[i].name);
-
- if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Topen2 failed");
-
- /* Copy the datatype anonymously */
- if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, travt, options)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "copy_named_datatype failed");
+ if (H5Tclose(type_in) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ if (H5Tclose(type_out) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ type_out = H5I_INVALID_HID; /* named datatypes stack, named_dt_head, manages allocation */
- /* Link in to group structure */
- if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Lcreate_hard failed");
+ break;
/*-------------------------------------------------------------------------
- * copy attrs
+ * H5TRAV_TYPE_LINK
+ * H5TRAV_TYPE_UDLINK
+ *
+ * Only handles external links; H5Lcopy will fail for other UD link types
+ * since we don't have creation or copy callbacks for them.
*-------------------------------------------------------------------------
*/
- if (copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0)
- H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
+ case H5TRAV_TYPE_LINK:
+ case H5TRAV_TYPE_UDLINK:
+ if (options->verbose)
+ HDprintf(FORMAT_OBJ, "link", travt->objs[i].name);
+
+ /* Check -X option. */
+ if (options->merge) {
+ if (H5tools_get_symlink_info(fidin, travt->objs[i].name, &linkinfo, 1) == 0) {
+ /* dangling link */
+ if (options->prune) {
+ HDprintf("Pruned %s.\n", travt->objs[i].name);
+ }
+ else {
+ if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed");
+ }
+ }
+ else {
+ /* valid link */
+ /* create property to pass copy options */
+ if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate create property failed");
+
+ /* set options for object copy */
+ if (H5Pset_copy_object(ocpl_id, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed");
+
+ /* Create link creation property list */
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate link creation property failed");
+ }
- if (H5Tclose(type_in) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if (H5Tclose(type_out) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- type_out = H5I_INVALID_HID; /* named datatypes stack, named_dt_head, manages allocation */
+ /* Set flag for intermediate group creation */
+ if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_create_intermediate_group failed");
- break;
+ if (H5Ocopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, ocpl_id,
+ lcpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed");
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_LINK
- * H5TRAV_TYPE_UDLINK
- *
- * Only handles external links; H5Lcopy will fail for other UD link types
- * since we don't have creation or copy callbacks for them.
- *-------------------------------------------------------------------------
- */
- case H5TRAV_TYPE_LINK:
- case H5TRAV_TYPE_UDLINK:
- if (options->verbose)
- HDprintf(FORMAT_OBJ, "link", travt->objs[i].name);
-
- /* Check -X option. */
- if (options->merge) {
- if (H5tools_get_symlink_info(fidin, travt->objs[i].name, &linkinfo, 1) == 0) {
- /* dangling link */
+ if (H5Pclose(lcpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+
+ if (H5Pclose(ocpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ }
+
+ /* free link info path */
+ if (linkinfo.trg_path)
+ HDfree(linkinfo.trg_path);
+ linkinfo.trg_path = NULL;
+ } /* options->merge */
+ else {
if (options->prune) {
HDprintf("Pruned %s.\n", travt->objs[i].name);
}
else {
- if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT,
+ H5P_DEFAULT) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed");
}
}
- else {
- /* valid link */
- /* create property to pass copy options */
- if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pcreate create property failed");
+ break;
- /* set options for object copy */
- if (H5Pset_copy_object(ocpl_id, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed");
-
- /* Create link creation property list */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
- H5TOOLS_GOTO_ERROR((-1), "H5Pcreate link creation property failed");
- }
-
- /* Set flag for intermediate group creation */
- if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_create_intermediate_group failed");
-
- if (H5Ocopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, ocpl_id, lcpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed");
-
- if (H5Pclose(lcpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
-
- if (H5Pclose(ocpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- }
-
- /* free link info path */
- if (linkinfo.trg_path)
- HDfree(linkinfo.trg_path);
- linkinfo.trg_path = NULL;
- } /* options->merge */
- else {
- if (options->prune) {
- HDprintf("Pruned %s.\n", travt->objs[i].name);
- }
- else {
- if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed");
- }
- }
- break;
-
- default:
- H5TOOLS_GOTO_ERROR((-1), "Object type not found");
+ default:
+ H5TOOLS_GOTO_ERROR((-1), "Object type not found");
} /* switch */
- } /* end for each object to traverse */
- } /* end if there are objects */
+ } /* end for each object to traverse */
+ } /* end if there are objects */
done:
@@ -1268,9 +1302,8 @@ done:
H5TOOLS_ERROR((-1), "named_datatype_free failed");
}
else {
- H5E_BEGIN_TRY {
- named_datatype_free(&named_dt_head, 1);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { named_datatype_free(&named_dt_head, 1); }
+ H5E_END_TRY;
}
/* free link info path */
@@ -1293,7 +1326,8 @@ done:
H5Tclose(wtype_id);
H5Tclose(type_in);
H5Tclose(type_out);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* free */
if (buf != NULL)
@@ -1313,17 +1347,17 @@ done:
static void
print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
{
- char strfilter[255];
-#if defined (PRINT_DEBUG )
- char temp[255];
+ char strfilter[255];
+#if defined(PRINT_DEBUG)
+ char temp[255];
#endif
- int nfilters; /* number of filters */
- unsigned filt_flags; /* filter flags */
- H5Z_filter_t filtn; /* filter identification number */
- unsigned cd_values[20]; /* filter client data values */
- size_t cd_nelmts; /* filter client number of values */
- char f_objname[256]; /* filter objname */
- int i;
+ int nfilters; /* number of filters */
+ unsigned filt_flags; /* filter flags */
+ H5Z_filter_t filtn; /* filter identification number */
+ unsigned cd_values[20]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+ char f_objname[256]; /* filter objname */
+ int i;
HDstrcpy(strfilter, "\0");
@@ -1334,8 +1368,8 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
for (i = 0; i < nfilters; i++) {
cd_nelmts = NELMTS(cd_values);
- if ((filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts,
- cd_values, sizeof(f_objname), f_objname, NULL)) < 0) {
+ if ((filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, cd_values,
+ sizeof(f_objname), f_objname, NULL)) < 0) {
HDstrcat(strfilter, "ERROR ");
continue;
}
@@ -1348,11 +1382,11 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
case H5Z_FILTER_DEFLATE:
HDstrcat(strfilter, "GZIP ");
-#if defined (PRINT_DEBUG)
+#if defined(PRINT_DEBUG)
{
unsigned level = cd_values[0];
- HDsprintf(temp,"(%d)", level);
+ HDsprintf(temp, "(%d)", level);
HDstrcat(strfilter, temp);
}
#endif
@@ -1361,12 +1395,12 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
case H5Z_FILTER_SZIP:
HDstrcat(strfilter, "SZIP ");
-#if defined (PRINT_DEBUG)
+#if defined(PRINT_DEBUG)
{
unsigned options_mask = cd_values[0]; /* from dcpl, not filt*/
- unsigned ppb = cd_values[1];
+ unsigned ppb = cd_values[1];
- HDsprintf(temp,"(%d,", ppb);
+ HDsprintf(temp, "(%d,", ppb);
HDstrcat(strfilter, temp);
if (options_mask & H5_SZIP_EC_OPTION_MASK)
HDstrcpy(temp, "EC) ");
@@ -1397,7 +1431,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
HDstrcat(strfilter, "UD ");
break;
} /* end switch */
- } /* end for each filter */
+ } /* end for each filter */
if (!pr)
HDprintf(FORMAT_OBJ, "dset", objname);
@@ -1436,9 +1470,9 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size)
/* Copy the userblock from the input file to the output file */
while (size > 0) {
- ssize_t nread, nbytes; /* # of bytes transfered, etc. */
- char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */
- const char *wbuf; /* Pointer into buffer, for writing */
+ ssize_t nread, nbytes; /* # of bytes transfered, etc. */
+ char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */
+ const char *wbuf; /* Pointer into buffer, for writing */
/* Read buffer from source file */
if (size > USERBLOCK_XFER_SIZE)
@@ -1451,14 +1485,14 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size)
/* Write buffer to destination file */
/* (compensating for interrupted writes & checking for errors, etc.) */
nbytes = nread;
- wbuf = rbuf;
+ wbuf = rbuf;
while (nbytes > 0) {
ssize_t nwritten; /* # of bytes written */
do {
nwritten = HDwrite(outfid, wbuf, (size_t)nbytes);
} while (-1 == nwritten && EINTR == errno);
- if (-1 == nwritten) /* error */
+ if (-1 == nwritten) /* error */
H5TOOLS_GOTO_ERROR((-1), "HDwrite failed");
HDassert(nwritten > 0);
HDassert(nwritten <= nbytes);
@@ -1470,7 +1504,7 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size)
} /* end while */
/* Update size of userblock left to transfer */
- size = size - (hsize_t) nread;
+ size = size - (hsize_t)nread;
} /* end while */
done:
@@ -1490,14 +1524,13 @@ done:
* Return: 0, ok, -1 no
*-------------------------------------------------------------------------
*/
-#if defined (H5REPACK_DEBUG_USER_BLOCK)
-static
-void
+#if defined(H5REPACK_DEBUG_USER_BLOCK)
+static void
print_user_block(const char *filename, hid_t fid)
{
- int fh = -1; /* file handle */
- hsize_t ub_size; /* user block size */
- hsize_t size; /* size read */
+ int fh = -1; /* file handle */
+ hsize_t ub_size; /* user block size */
+ hsize_t size; /* size read */
hid_t fcpl = H5I_INVALID_HID; /* file creation property list ID for HDF5 file */
int i;
int ret_value = 0;
@@ -1524,8 +1557,8 @@ print_user_block(const char *filename, hid_t fid)
/* read file */
while (size > 0) {
- ssize_t nread; /* # of bytes read */
- char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */
+ ssize_t nread; /* # of bytes read */
+ char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */
/* read buffer */
if (size > USERBLOCK_XFER_SIZE)
@@ -1536,7 +1569,6 @@ print_user_block(const char *filename, hid_t fid)
for (i = 0; i < nread; i++) {
HDprintf("%c ", rbuf[i]);
-
}
HDprintf("\n");
@@ -1555,4 +1587,3 @@ done:
return;
} /* end print_user_block() */
#endif
-
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
index d1179fb..0570c0f 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -17,12 +17,12 @@
/* number of members in an array */
#ifndef NELMTS
-# define NELMTS(X) (sizeof(X)/sizeof(X[0]))
+#define NELMTS(X) (sizeof(X) / sizeof(X[0]))
#endif
/* minimum of two values */
#undef MIN
-#define MIN(a,b) (((a)<(b)) ? (a) : (b))
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
/*-------------------------------------------------------------------------
* Function: aux_copy_obj
@@ -32,15 +32,16 @@
* Return: 0 success, -1 failure
*-------------------------------------------------------------------------
*/
-static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
- const char* name, /* object name from traverse list */
- pack_info_t *objout /*OUT*/) /* info about object to filter */
+static int
+aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
+ const char * name, /* object name from traverse list */
+ pack_info_t *objout /*OUT*/) /* info about object to filter */
{
int nfilters; /* number of filters in DCPL */
char f_objname[256]; /* filter objname */
H5D_layout_t layout;
- int rank; /* rank of dataset */
- hsize_t chsize[64]; /* chunk size in elements */
+ int rank; /* rank of dataset */
+ hsize_t chsize[64]; /* chunk size in elements */
int i;
unsigned u;
int ret_value = 0;
@@ -50,8 +51,9 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
H5TOOLS_GOTO_ERROR((-1), "H5Pget_nfilters failed");
/* copy filter_info_t structure */
for (i = 0; i < nfilters; i++) {
- if ((objout->filter[i].filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &objout->filter[i].filt_flag, &objout->filter[i].cd_nelmts,
- objout->filter[i].cd_values, sizeof(f_objname), f_objname, NULL)) < 0)
+ if ((objout->filter[i].filtn = H5Pget_filter2(
+ dcpl_id, (unsigned)i, &objout->filter[i].filt_flag, &objout->filter[i].cd_nelmts,
+ objout->filter[i].cd_values, sizeof(f_objname), f_objname, NULL)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_filter2 failed");
}
@@ -63,7 +65,7 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
objout->layout = layout;
if (layout == H5D_CHUNKED) {
- if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
+ if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize /*out*/)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_chunk failed");
objout->chunk.rank = rank;
for (u = 0; u < (unsigned)rank; u++)
@@ -81,30 +83,33 @@ done:
* in the repack options list
*-------------------------------------------------------------------------
*/
-static int aux_find_obj(const char* name, /* object name from traverse list */
- pack_opt_t *options, /* repack options */
- pack_info_t *obj /*OUT*/) /* info about object to filter */
+static int
+aux_find_obj(const char * name, /* object name from traverse list */
+ pack_opt_t * options, /* repack options */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
{
- char *pdest = NULL;
- const char *pname = NULL;
+ char * pdest = NULL;
+ const char * pname = NULL;
unsigned int i;
for (i = 0; i < options->op_tbl->nelems; i++) {
if (HDstrcmp(options->op_tbl->objs[i].path, name) == 0) {
*obj = options->op_tbl->objs[i];
- return (int) i;
+ return (int)i;
}
pdest = options->op_tbl->objs[i].path;
- if (pdest[0] == '/') pdest++;
+ if (pdest[0] == '/')
+ pdest++;
pname = name;
- if (pname[0] == '/') pname++;
+ if (pname[0] == '/')
+ pname++;
if (HDstrcmp(pdest, pname) == 0) {
*obj = options->op_tbl->objs[i];
- return (int) i;
+ return (int)i;
}
- }/*i*/
+ } /*i*/
return -1;
}
@@ -118,9 +123,10 @@ static int aux_find_obj(const char* name, /* object name from traverse list */
* Return: 0 not found, 1 found
*-------------------------------------------------------------------------
*/
-static int aux_assign_obj(const char* name, /* object name from traverse list */
- pack_opt_t *options, /* repack options */
- pack_info_t *obj /*OUT*/) /* info about object to filter */
+static int
+aux_assign_obj(const char * name, /* object name from traverse list */
+ pack_opt_t * options, /* repack options */
+ pack_info_t *obj /*OUT*/) /* info about object to filter */
{
int idx, i;
pack_info_t tmp;
@@ -136,44 +142,44 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */
/* assign the global layout info to the OBJ info */
tmp.layout = options->layout_g;
switch (options->layout_g) {
- case H5D_CHUNKED:
- tmp.chunk.rank = options->chunk_g.rank;
- for (i = 0; i < tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i] = options->chunk_g.chunk_lengths[i];
- break;
- case H5D_LAYOUT_ERROR:
- case H5D_COMPACT:
- case H5D_CONTIGUOUS:
- case H5D_VIRTUAL:
- case H5D_NLAYOUTS:
- break;
- default:
- break;
- }/*switch*/
+ case H5D_CHUNKED:
+ tmp.chunk.rank = options->chunk_g.rank;
+ for (i = 0; i < tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i] = options->chunk_g.chunk_lengths[i];
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_COMPACT:
+ case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
+ case H5D_NLAYOUTS:
+ break;
+ default:
+ break;
+ } /*switch*/
}
else {
tmp.layout = options->op_tbl->objs[idx].layout;
switch (tmp.layout) {
- case H5D_CHUNKED:
- tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank;
- for (i = 0; i < tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i] = options->op_tbl->objs[idx].chunk.chunk_lengths[i];
- break;
- case H5D_LAYOUT_ERROR:
- case H5D_COMPACT:
- case H5D_CONTIGUOUS:
- case H5D_VIRTUAL:
- case H5D_NLAYOUTS:
- break;
- default:
- break;
- }/*switch*/
+ case H5D_CHUNKED:
+ tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank;
+ for (i = 0; i < tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i] = options->op_tbl->objs[idx].chunk.chunk_lengths[i];
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_COMPACT:
+ case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
+ case H5D_NLAYOUTS:
+ break;
+ default:
+ break;
+ } /*switch*/
}
/* applying to all objects */
if (options->all_filter) {
/* assign the global filter */
- tmp.nfilters = 1;
+ tmp.nfilters = 1;
tmp.filter[0] = options->filter_g[0];
} /* if all */
else {
@@ -197,21 +203,20 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */
/* assign the global layout info to the OBJ info */
tmp.layout = options->layout_g;
switch (options->layout_g) {
- case H5D_CHUNKED:
- tmp.chunk.rank = options->chunk_g.rank;
- for (i = 0; i < tmp.chunk.rank; i++)
- tmp.chunk.chunk_lengths[i] =
- options->chunk_g.chunk_lengths[i];
- break;
- case H5D_LAYOUT_ERROR:
- case H5D_COMPACT:
- case H5D_CONTIGUOUS:
- case H5D_VIRTUAL:
- case H5D_NLAYOUTS:
- break;
- default:
- break;
- }/*switch*/
+ case H5D_CHUNKED:
+ tmp.chunk.rank = options->chunk_g.rank;
+ for (i = 0; i < tmp.chunk.rank; i++)
+ tmp.chunk.chunk_lengths[i] = options->chunk_g.chunk_lengths[i];
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_COMPACT:
+ case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
+ case H5D_NLAYOUTS:
+ break;
+ default:
+ break;
+ } /*switch*/
}
}
@@ -230,16 +235,17 @@ static int aux_assign_obj(const char* name, /* object name from traverse list */
*-------------------------------------------------------------------------
*/
-int apply_filters(const char* name, /* object name from traverse list */
- int rank, /* rank of dataset */
- hsize_t *dims, /* dimensions of dataset */
- size_t msize, /* size of type */
- hid_t dcpl_id, /* dataset creation property list */
- pack_opt_t *options, /* repack options */
- int *has_filter) /* (OUT) object NAME has a filter */
+int
+apply_filters(const char *name, /* object name from traverse list */
+ int rank, /* rank of dataset */
+ hsize_t * dims, /* dimensions of dataset */
+ size_t msize, /* size of type */
+ hid_t dcpl_id, /* dataset creation property list */
+ pack_opt_t *options, /* repack options */
+ int * has_filter) /* (OUT) object NAME has a filter */
{
- int nfilters; /* number of filters in DCPL */
- hsize_t chsize[64]; /* chunk size in elements */
+ int nfilters; /* number of filters in DCPL */
+ hsize_t chsize[64]; /* chunk size in elements */
H5D_layout_t layout;
int i;
pack_info_t obj;
@@ -269,7 +275,6 @@ int apply_filters(const char* name, /* object name from traverse list */
if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_nfilters failed");
-
/*-------------------------------------------------------------------------
* check if we have filters in the pipeline
* we want to replace them with the input filters
@@ -281,7 +286,7 @@ int apply_filters(const char* name, /* object name from traverse list */
if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Premove_filter failed");
}
- else if(nfilters) {
+ else if (nfilters) {
*has_filter = 1;
if (aux_copy_obj(dcpl_id, name, &filtobj) < 0)
H5TOOLS_GOTO_ERROR((-1), "aux_copy_obj failed");
@@ -297,9 +302,9 @@ int apply_filters(const char* name, /* object name from traverse list */
H5TOOLS_GOTO_ERROR((-1), "H5Pget_layout failed");
if (layout == H5D_CHUNKED) {
- if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
+ if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize /*out*/)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_chunk failed");
- obj.layout = H5D_CHUNKED;
+ obj.layout = H5D_CHUNKED;
obj.chunk.rank = rank;
for (i = 0; i < rank; i++)
obj.chunk.chunk_lengths[i] = chsize[i];
@@ -327,7 +332,7 @@ int apply_filters(const char* name, /* object name from traverse list */
if (obj.layout == -1) {
/* stripmine info */
hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
- hsize_t sm_nbytes; /*bytes per stripmine */
+ hsize_t sm_nbytes; /*bytes per stripmine */
obj.chunk.rank = rank;
@@ -339,7 +344,7 @@ int apply_filters(const char* name, /* object name from traverse list */
sm_nbytes = msize;
for (i = rank; i > 0; --i) {
hsize_t size = 0;
- if(sm_nbytes == 0)
+ if (sm_nbytes == 0)
H5TOOLS_GOTO_ERROR((-1), "number of bytes per stripmine must be > 0");
size = H5TOOLS_BUFSIZE / sm_nbytes;
if (size == 0) /* datum size > H5TOOLS_BUFSIZE */
@@ -358,19 +363,18 @@ int apply_filters(const char* name, /* object name from traverse list */
H5TOOLS_GOTO_ERROR((-1), "invalid filter");
switch (obj.filter[i].filtn) {
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_NONE 0 , uncompress if compressed
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_NONE:
- break;
-
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE 1 , deflation like gzip
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_DEFLATE:
- {
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_NONE 0 , uncompress if compressed
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_NONE:
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_DEFLATE 1 , deflation like gzip
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_DEFLATE: {
unsigned aggression; /* the deflate level */
aggression = obj.filter[i].cd_values[0];
@@ -379,19 +383,17 @@ int apply_filters(const char* name, /* object name from traverse list */
H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
if (H5Pset_deflate(dcpl_id, aggression) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_deflate failed");
- }
- break;
+ } break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP 4 , szip compression
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SZIP:
- {
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP 4 , szip compression
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SZIP: {
unsigned options_mask;
unsigned pixels_per_block;
- options_mask = obj.filter[i].cd_values[0];
+ options_mask = obj.filter[i].cd_values[0];
pixels_per_block = obj.filter[i].cd_values[1];
/* set up for szip data */
@@ -399,70 +401,64 @@ int apply_filters(const char* name, /* object name from traverse list */
H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
if (H5Pset_szip(dcpl_id, options_mask, pixels_per_block) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_szip failed");
- }
- break;
+ } break;
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_SHUFFLE 2 , shuffle the data
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SHUFFLE:
- if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
- if (H5Pset_shuffle(dcpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_shuffle failed");
- break;
-
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_FLETCHER32:
- if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
- if (H5Pset_fletcher32(dcpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_fletcher32 failed");
- break;
- /*----------- -------------------------------------------------------------
- * H5Z_FILTER_NBIT , NBIT compression
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_NBIT:
- if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
- if (H5Pset_nbit(dcpl_id) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pset_nbit failed");
- break;
- /*----------- -------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET , scale+offset compression
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SCALEOFFSET:
- {
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SHUFFLE 2 , shuffle the data
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SHUFFLE:
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
+ if (H5Pset_shuffle(dcpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_shuffle failed");
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_FLETCHER32:
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
+ if (H5Pset_fletcher32(dcpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_fletcher32 failed");
+ break;
+ /*----------- -------------------------------------------------------------
+ * H5Z_FILTER_NBIT , NBIT compression
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_NBIT:
+ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
+ if (H5Pset_nbit(dcpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_nbit failed");
+ break;
+ /*----------- -------------------------------------------------------------
+ * H5Z_FILTER_SCALEOFFSET , scale+offset compression
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SCALEOFFSET: {
H5Z_SO_scale_type_t scale_type;
- int scale_factor;
+ int scale_factor;
- scale_type = (H5Z_SO_scale_type_t) obj.filter[i].cd_values[0];
- scale_factor = (int) obj.filter[i].cd_values[1];
+ scale_type = (H5Z_SO_scale_type_t)obj.filter[i].cd_values[0];
+ scale_factor = (int)obj.filter[i].cd_values[1];
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
if (H5Pset_scaleoffset(dcpl_id, scale_type, scale_factor) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_scaleoffset failed");
- }
- break;
- default:
- {
+ } break;
+ default: {
if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_chunk failed");
- if (H5Pset_filter(dcpl_id, obj.filter[i].filtn,
- obj.filter[i].filt_flag, obj.filter[i].cd_nelmts,
- obj.filter[i].cd_values) < 0)
+ if (H5Pset_filter(dcpl_id, obj.filter[i].filtn, obj.filter[i].filt_flag,
+ obj.filter[i].cd_nelmts, obj.filter[i].cd_values) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_filter failed");
- }
- break;
+ } break;
} /* switch */
- }/*i*/
+ } /*i*/
}
/*obj.nfilters*/
@@ -474,7 +470,7 @@ int apply_filters(const char* name, /* object name from traverse list */
if (H5Zfilter_avail(filtobj.filter[i].filtn) <= 0)
H5TOOLS_GOTO_ERROR((-1), "%d filter unavailable", filtobj.filter[i].filtn);
} /* for */
- } /* nfilters */
+ } /* nfilters */
/*-------------------------------------------------------------------------
* layout
@@ -504,4 +500,3 @@ int apply_filters(const char* name, /* object name from traverse list */
done:
return ret_value;
}
-
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 009755e..3a82963 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -18,54 +18,51 @@
/* Name of tool */
#define PROGRAMNAME "h5repack"
-static int parse_command_line(int argc, const char **argv, pack_opt_t* options);
+static int parse_command_line(int argc, const char **argv, pack_opt_t *options);
static void leave(int ret) H5_ATTR_NORETURN;
-
/* module-scoped variables */
-static int has_i = 0;
-static int has_o = 0;
-const char *infile = NULL;
+static int has_i = 0;
+static int has_o = 0;
+const char *infile = NULL;
const char *outfile = NULL;
/*
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW";
-static struct long_options l_opts[] = {
- { "alignment", require_arg, 'a' },
- { "block", require_arg, 'b' },
- { "compact", require_arg, 'c' },
- { "indexed", require_arg, 'd' },
- { "file", require_arg, 'e' },
- { "filter", require_arg, 'f' },
- { "help", no_arg, 'h' },
- { "infile", require_arg, 'i' }, /* for backward compability */
- { "low", require_arg, 'j' },
- { "high", require_arg, 'k' },
- { "layout", require_arg, 'l' },
- { "minimum", require_arg, 'm' },
- { "native", no_arg, 'n' },
- { "outfile", require_arg, 'o' }, /* for backward compability */
- { "sort_by", require_arg, 'q' },
- { "ssize", require_arg, 's' },
- { "threshold", require_arg, 't' },
- { "ublock", require_arg, 'u' },
- { "verbose", no_arg, 'v' },
- { "sort_order", require_arg, 'z' },
- { "enable-error-stack", no_arg, 'E' },
- { "fs_pagesize", require_arg, 'G' },
- { "latest", no_arg, 'L' },
- { "metadata_block_size", require_arg, 'M' },
- { "fs_persist", require_arg, 'P' },
- { "fs_strategy", require_arg, 'S' },
- { "fs_threshold", require_arg, 'T' },
- { "version", no_arg, 'V' },
- { "merge", no_arg, 'X' },
- { "prune", no_arg, 'W' },
- { NULL, 0, '\0' }
-};
+static const char * s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW";
+static struct long_options l_opts[] = {{"alignment", require_arg, 'a'},
+ {"block", require_arg, 'b'},
+ {"compact", require_arg, 'c'},
+ {"indexed", require_arg, 'd'},
+ {"file", require_arg, 'e'},
+ {"filter", require_arg, 'f'},
+ {"help", no_arg, 'h'},
+ {"infile", require_arg, 'i'}, /* for backward compability */
+ {"low", require_arg, 'j'},
+ {"high", require_arg, 'k'},
+ {"layout", require_arg, 'l'},
+ {"minimum", require_arg, 'm'},
+ {"native", no_arg, 'n'},
+ {"outfile", require_arg, 'o'}, /* for backward compability */
+ {"sort_by", require_arg, 'q'},
+ {"ssize", require_arg, 's'},
+ {"threshold", require_arg, 't'},
+ {"ublock", require_arg, 'u'},
+ {"verbose", no_arg, 'v'},
+ {"sort_order", require_arg, 'z'},
+ {"enable-error-stack", no_arg, 'E'},
+ {"fs_pagesize", require_arg, 'G'},
+ {"latest", no_arg, 'L'},
+ {"metadata_block_size", require_arg, 'M'},
+ {"fs_persist", require_arg, 'P'},
+ {"fs_strategy", require_arg, 'S'},
+ {"fs_threshold", require_arg, 'T'},
+ {"version", no_arg, 'V'},
+ {"merge", no_arg, 'X'},
+ {"prune", no_arg, 'W'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -76,7 +73,9 @@ static struct long_options l_opts[] = {
*
*-------------------------------------------------------------------------
*/
-static void usage(const char *prog) {
+static void
+usage(const char *prog)
+{
FLUSHSTREAM(rawoutstream);
PRINTSTREAM(rawoutstream, "usage: %s [OPTIONS] file1 file2\n", prog);
PRINTVALSTREAM(rawoutstream, " file1 Input HDF5 File\n");
@@ -86,91 +85,120 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " -v, --verbose Verbose mode, print object information\n");
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n");
- PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --enable-error-stack Prints messages from the HDF5 error stack as they\n");
PRINTVALSTREAM(rawoutstream, " occur\n");
PRINTVALSTREAM(rawoutstream, " -L, --latest Use latest version of file format\n");
- PRINTVALSTREAM(rawoutstream, " This option will take precedence over the options\n");
+ PRINTVALSTREAM(rawoutstream,
+ " This option will take precedence over the options\n");
PRINTVALSTREAM(rawoutstream, " --low and --high\n");
- PRINTVALSTREAM(rawoutstream, " --low=BOUND The low bound for library release versions to use\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --low=BOUND The low bound for library release versions to use\n");
PRINTVALSTREAM(rawoutstream, " when creating objects in the file\n");
PRINTVALSTREAM(rawoutstream, " (default is H5F_LIBVER_EARLIEST)\n");
- PRINTVALSTREAM(rawoutstream, " --high=BOUND The high bound for library release versions to use\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --high=BOUND The high bound for library release versions to use\n");
PRINTVALSTREAM(rawoutstream, " when creating objects in the file\n");
PRINTVALSTREAM(rawoutstream, " (default is H5F_LIBVER_LATEST)\n");
- PRINTVALSTREAM(rawoutstream, " --merge Follow external soft link recursively and merge data\n");
- PRINTVALSTREAM(rawoutstream, " --prune Do not follow external soft links and remove link\n");
- PRINTVALSTREAM(rawoutstream, " --merge --prune Follow external link, merge data and remove dangling link\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --merge Follow external soft link recursively and merge data\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --prune Do not follow external soft links and remove link\n");
+ PRINTVALSTREAM(rawoutstream,
+ " --merge --prune Follow external link, merge data and remove dangling link\n");
PRINTVALSTREAM(rawoutstream, " -c L1, --compact=L1 Maximum number of links in header messages\n");
- PRINTVALSTREAM(rawoutstream, " -d L2, --indexed=L2 Minimum number of links in the indexed format\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -d L2, --indexed=L2 Minimum number of links in the indexed format\n");
PRINTVALSTREAM(rawoutstream, " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n");
- PRINTVALSTREAM(rawoutstream, " -m M, --minimum=M Do not apply the filter to datasets smaller than M\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -m M, --minimum=M Do not apply the filter to datasets smaller than M\n");
PRINTVALSTREAM(rawoutstream, " -e E, --file=E Name of file E with the -f and -l options\n");
- PRINTVALSTREAM(rawoutstream, " -u U, --ublock=U Name of file U with user block data to be added\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -u U, --ublock=U Name of file U with user block data to be added\n");
PRINTVALSTREAM(rawoutstream, " -b B, --block=B Size of user block to be added\n");
- PRINTVALSTREAM(rawoutstream, " -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n");
PRINTVALSTREAM(rawoutstream, " -t T, --threshold=T Threshold value for H5Pset_alignment\n");
PRINTVALSTREAM(rawoutstream, " -a A, --alignment=A Alignment value for H5Pset_alignment\n");
PRINTVALSTREAM(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n");
PRINTVALSTREAM(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n");
PRINTVALSTREAM(rawoutstream, " -f FILT, --filter=FILT Filter type\n");
PRINTVALSTREAM(rawoutstream, " -l LAYT, --layout=LAYT Layout type\n");
- PRINTVALSTREAM(rawoutstream, " -S FS_STRATEGY, --fs_strategy=FS_STRATEGY File space management strategy for\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -S FS_STRATEGY, --fs_strategy=FS_STRATEGY File space management strategy for\n");
PRINTVALSTREAM(rawoutstream, " H5Pset_file_space_strategy\n");
- PRINTVALSTREAM(rawoutstream, " -P FS_PERSIST, --fs_persist=FS_PERSIST Persisting or not persisting free-\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -P FS_PERSIST, --fs_persist=FS_PERSIST Persisting or not persisting free-\n");
PRINTVALSTREAM(rawoutstream, " space for H5Pset_file_space_strategy\n");
- PRINTVALSTREAM(rawoutstream, " -T FS_THRESHOLD, --fs_threshold=FS_THRESHOLD Free-space section threshold\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -T FS_THRESHOLD, --fs_threshold=FS_THRESHOLD Free-space section threshold\n");
PRINTVALSTREAM(rawoutstream, " for H5Pset_file_space_strategy\n");
PRINTVALSTREAM(rawoutstream, " -G FS_PAGESIZE, --fs_pagesize=FS_PAGESIZE File space page size for\n");
PRINTVALSTREAM(rawoutstream, " H5Pset_file_space_page_size\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " M - is an integer greater than 1, size of dataset in bytes (default is 0)\n");
+ PRINTVALSTREAM(rawoutstream,
+ " M - is an integer greater than 1, size of dataset in bytes (default is 0)\n");
PRINTVALSTREAM(rawoutstream, " E - is a filename.\n");
PRINTVALSTREAM(rawoutstream, " S - is an integer\n");
PRINTVALSTREAM(rawoutstream, " U - is a filename.\n");
PRINTVALSTREAM(rawoutstream, " T - is an integer\n");
PRINTVALSTREAM(rawoutstream, " A - is an integer greater than zero\n");
- PRINTVALSTREAM(rawoutstream, " Q - is the sort index type for the input file. It can be \"name\" or\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Q - is the sort index type for the input file. It can be \"name\" or\n");
PRINTVALSTREAM(rawoutstream, " \"creation_order\" (default)\n");
- PRINTVALSTREAM(rawoutstream, " Z - is the sort order type for the input file. It can be \"descending\" or\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Z - is the sort order type for the input file. It can be \"descending\" or\n");
PRINTVALSTREAM(rawoutstream, " \"ascending\" (default)\n");
PRINTVALSTREAM(rawoutstream, " B - is the user block size, any value that is 512 or greater and is\n");
PRINTVALSTREAM(rawoutstream, " a power of 2 (1024 default)\n");
- PRINTVALSTREAM(rawoutstream, " F - is the shared object header message type, any of <dspace|dtype|fill|\n");
+ PRINTVALSTREAM(rawoutstream,
+ " F - is the shared object header message type, any of <dspace|dtype|fill|\n");
PRINTVALSTREAM(rawoutstream, " pline|attr>. If F is not specified, S applies to all messages\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " BOUND is an integer indicating the library release versions to use when\n");
+ PRINTVALSTREAM(rawoutstream,
+ " BOUND is an integer indicating the library release versions to use when\n");
PRINTVALSTREAM(rawoutstream, " creating objects in the file (see H5Pset_libver_bounds()):\n");
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, " (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V110 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");
- PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are free-space\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The mechanisms used in managing file space are free-space\n");
PRINTVALSTREAM(rawoutstream, " managers, aggregators and virtual file driver.\n");
PRINTVALSTREAM(rawoutstream, " PAGE:\n");
- PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are free-space\n");
- PRINTVALSTREAM(rawoutstream, " managers with embedded paged aggregation and virtual file driver.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The mechanisms used in managing file space are free-space\n");
+ PRINTVALSTREAM(rawoutstream,
+ " managers with embedded paged aggregation and virtual file driver.\n");
PRINTVALSTREAM(rawoutstream, " AGGR:\n");
- PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are aggregators and\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The mechanisms used in managing file space are aggregators and\n");
PRINTVALSTREAM(rawoutstream, " virtual file driver.\n");
PRINTVALSTREAM(rawoutstream, " NONE:\n");
- PRINTVALSTREAM(rawoutstream, " The mechanisms used in managing file space are virtual file\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The mechanisms used in managing file space are virtual file\n");
PRINTVALSTREAM(rawoutstream, " driver.\n");
- PRINTVALSTREAM(rawoutstream, " The default strategy when not set is FSM_AGGR without persisting free-\n");
+ PRINTVALSTREAM(rawoutstream,
+ " The default strategy when not set is FSM_AGGR without persisting free-\n");
PRINTVALSTREAM(rawoutstream, " space.\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " FS_PERSIST is 1 to persisting free-space or 0 to not persisting free-space.\n");
+ PRINTVALSTREAM(rawoutstream,
+ " FS_PERSIST is 1 to persisting free-space or 0 to not persisting free-space.\n");
PRINTVALSTREAM(rawoutstream, " The default when not set is not persisting free-space.\n");
PRINTVALSTREAM(rawoutstream, " The value is ignored for AGGR and NONE strategies.\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " FS_THRESHOLD is the minimum size (in bytes) of free-space sections to be\n");
+ PRINTVALSTREAM(rawoutstream,
+ " FS_THRESHOLD is the minimum size (in bytes) of free-space sections to be\n");
PRINTVALSTREAM(rawoutstream, " tracked by the library.\n");
PRINTVALSTREAM(rawoutstream, " The default when not set is 1.\n");
PRINTVALSTREAM(rawoutstream, " The value is ignored for AGGR and NONE strategies.\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " FS_PAGESIZE is the size (in bytes) >=512 that is used by the library when\n");
+ PRINTVALSTREAM(rawoutstream,
+ " FS_PAGESIZE is the size (in bytes) >=512 that is used by the library when\n");
PRINTVALSTREAM(rawoutstream, " the file space strategy PAGE is used.\n");
PRINTVALSTREAM(rawoutstream, " The default when not set is 4096.\n");
PRINTVALSTREAM(rawoutstream, "\n");
@@ -178,8 +206,10 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " <list of objects>:<name of filter>=<filter parameters>\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " <list of objects> is a comma separated list of object names, meaning apply\n");
- PRINTVALSTREAM(rawoutstream, " compression only to those objects. If no names are specified, the filter\n");
+ PRINTVALSTREAM(rawoutstream,
+ " <list of objects> is a comma separated list of object names, meaning apply\n");
+ PRINTVALSTREAM(rawoutstream,
+ " compression only to those objects. If no names are specified, the filter\n");
PRINTVALSTREAM(rawoutstream, " is applied to all objects\n");
PRINTVALSTREAM(rawoutstream, " <name of filter> can be:\n");
PRINTVALSTREAM(rawoutstream, " GZIP, to apply the HDF5 GZIP filter (GZIP compression)\n");
@@ -192,15 +222,19 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " NONE, to remove all filters\n");
PRINTVALSTREAM(rawoutstream, " <filter parameters> is optional filter parameter information\n");
PRINTVALSTREAM(rawoutstream, " GZIP=<deflation level> from 1-9\n");
- PRINTVALSTREAM(rawoutstream, " SZIP=<pixels per block,coding> pixels per block is a even number in\n");
+ PRINTVALSTREAM(rawoutstream,
+ " SZIP=<pixels per block,coding> pixels per block is a even number in\n");
PRINTVALSTREAM(rawoutstream, " 2-32 and coding method is either EC or NN\n");
PRINTVALSTREAM(rawoutstream, " SHUF (no parameter)\n");
PRINTVALSTREAM(rawoutstream, " FLET (no parameter)\n");
PRINTVALSTREAM(rawoutstream, " NBIT (no parameter)\n");
- PRINTVALSTREAM(rawoutstream, " SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n");
+ PRINTVALSTREAM(rawoutstream,
+ " SOFF=<scale_factor,scale_type> scale_factor is an integer and scale_type\n");
PRINTVALSTREAM(rawoutstream, " is either IN or DS\n");
- PRINTVALSTREAM(rawoutstream, " UD=<filter_number,filter_flag,cd_value_count,value1[,value2,...,valueN]>\n");
- PRINTVALSTREAM(rawoutstream, " Required values: filter_number, filter_flag, cd_value_count, value1\n");
+ PRINTVALSTREAM(rawoutstream,
+ " UD=<filter_number,filter_flag,cd_value_count,value1[,value2,...,valueN]>\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Required values: filter_number, filter_flag, cd_value_count, value1\n");
PRINTVALSTREAM(rawoutstream, " Optional values: value2 to valueN\n");
PRINTVALSTREAM(rawoutstream, " NONE (no parameter)\n");
PRINTVALSTREAM(rawoutstream, "\n");
@@ -208,8 +242,10 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " <list of objects>:<layout type>=<layout parameters>\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " <list of objects> is a comma separated list of object names, meaning that\n");
- PRINTVALSTREAM(rawoutstream, " layout information is supplied for those objects. If no names are\n");
+ PRINTVALSTREAM(rawoutstream,
+ " <list of objects> is a comma separated list of object names, meaning that\n");
+ PRINTVALSTREAM(rawoutstream,
+ " layout information is supplied for those objects. If no names are\n");
PRINTVALSTREAM(rawoutstream, " specified, the layout type is applied to all objects\n");
PRINTVALSTREAM(rawoutstream, " <layout type> can be:\n");
PRINTVALSTREAM(rawoutstream, " CHUNK, to apply chunking layout\n");
@@ -228,11 +264,14 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "2) h5repack -v -f dset1:SZIP=8,NN file1 file2\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " SZIP compression with 8 pixels per block and NN coding method to object dset1\n");
+ PRINTVALSTREAM(rawoutstream,
+ " SZIP compression with 8 pixels per block and NN coding method to object dset1\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, "3) h5repack -v -l dset1,dset2:CHUNK=20x10 -f dset3,dset4,dset5:NONE file1 file2\n");
+ PRINTVALSTREAM(rawoutstream,
+ "3) h5repack -v -l dset1,dset2:CHUNK=20x10 -f dset3,dset4,dset5:NONE file1 file2\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " Chunked layout, with a layout size of 20x10, to objects dset1 and dset2\n");
+ PRINTVALSTREAM(rawoutstream,
+ " Chunked layout, with a layout size of 20x10, to objects dset1 and dset2\n");
PRINTVALSTREAM(rawoutstream, " and remove filters to objects dset3, dset4, dset5\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "4) h5repack -L -c 10 -s 20:dtype file1 file2\n");
@@ -263,7 +302,8 @@ static void usage(const char *prog) {
* Return: Does not return
*-------------------------------------------------------------------------
*/
-static void leave(int ret)
+static void
+leave(int ret)
{
h5tools_close();
HDexit(ret);
@@ -277,15 +317,15 @@ static void leave(int ret)
* Return: void, exit on error
*-------------------------------------------------------------------------
*/
-static
-int read_info(const char *filename, pack_opt_t *options)
+static int
+read_info(const char *filename, pack_opt_t *options)
{
- char stype[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- char comp_info[1024];
+ char stype[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ char comp_info[1024];
FILE *fp = NULL;
- char c;
- int i;
- int ret_value = EXIT_SUCCESS;
+ char c;
+ int i;
+ int ret_value = EXIT_SUCCESS;
if (NULL == (fp = HDfopen(filename, "r"))) {
error_msg("cannot open options file %s\n", filename);
@@ -300,7 +340,7 @@ int read_info(const char *filename, pack_opt_t *options)
break;
/* Info indicator must be for layout or filter */
- if (HDstrcmp(stype,"-l") && HDstrcmp(stype, "-f")) {
+ if (HDstrcmp(stype, "-l") && HDstrcmp(stype, "-f")) {
error_msg("bad file format for %s", filename);
h5tools_setstatus(EXIT_FAILURE);
ret_value = EXIT_FAILURE;
@@ -414,15 +454,15 @@ set_sort_order(const char *form)
* Purpose: parse command line input
*-------------------------------------------------------------------------
*/
-static
-int parse_command_line(int argc, const char **argv, pack_opt_t* options)
+static int
+parse_command_line(int argc, const char **argv, pack_opt_t *options)
{
int bound, opt;
int ret_value = 0;
/* parse command line options */
while (EOF != (opt = get_option(argc, argv, s_opts, l_opts))) {
- switch ((char) opt) {
+ switch ((char)opt) {
/* -i for backward compatibility */
case 'i':
@@ -473,8 +513,8 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'm':
- options->min_comp = HDstrtoull(opt_arg , NULL, 0);
- if ((int) options->min_comp <= 0) {
+ options->min_comp = HDstrtoull(opt_arg, NULL, 0);
+ if ((int)options->min_comp <= 0) {
error_msg("invalid minimum compress size <%s>\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
@@ -530,66 +570,64 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'c':
- options->grp_compact = HDatoi( opt_arg );
+ options->grp_compact = HDatoi(opt_arg);
if (options->grp_compact > 0)
options->latest = TRUE; /* must use latest format */
break;
case 'd':
- options->grp_indexed = HDatoi( opt_arg );
+ options->grp_indexed = HDatoi(opt_arg);
if (options->grp_indexed > 0)
options->latest = TRUE; /* must use latest format */
break;
- case 's':
- {
- int idx = 0;
- int ssize = 0;
- char *msgPtr = HDstrchr(opt_arg, ':');
- options->latest = TRUE; /* must use latest format */
- if (msgPtr == NULL) {
- ssize = HDatoi(opt_arg);
- for (idx = 0; idx < 5; idx++)
- options->msg_size[idx] = ssize;
- }
- else {
- char msgType[10];
-
- HDstrcpy(msgType, msgPtr + 1);
- msgPtr[0] = '\0';
- ssize = HDatoi( opt_arg );
- if (!HDstrncmp(msgType, "dspace", 6))
- options->msg_size[0] = ssize;
- else if (!HDstrncmp(msgType, "dtype", 5))
- options->msg_size[1] = ssize;
- else if (!HDstrncmp(msgType, "fill", 4))
- options->msg_size[2] = ssize;
- else if (!HDstrncmp(msgType, "pline", 5))
- options->msg_size[3] = ssize;
- else if (!HDstrncmp(msgType, "attr", 4))
- options->msg_size[4] = ssize;
- }
+ case 's': {
+ int idx = 0;
+ int ssize = 0;
+ char *msgPtr = HDstrchr(opt_arg, ':');
+ options->latest = TRUE; /* must use latest format */
+ if (msgPtr == NULL) {
+ ssize = HDatoi(opt_arg);
+ for (idx = 0; idx < 5; idx++)
+ options->msg_size[idx] = ssize;
}
- break;
+ else {
+ char msgType[10];
+
+ HDstrcpy(msgType, msgPtr + 1);
+ msgPtr[0] = '\0';
+ ssize = HDatoi(opt_arg);
+ if (!HDstrncmp(msgType, "dspace", 6))
+ options->msg_size[0] = ssize;
+ else if (!HDstrncmp(msgType, "dtype", 5))
+ options->msg_size[1] = ssize;
+ else if (!HDstrncmp(msgType, "fill", 4))
+ options->msg_size[2] = ssize;
+ else if (!HDstrncmp(msgType, "pline", 5))
+ options->msg_size[3] = ssize;
+ else if (!HDstrncmp(msgType, "attr", 4))
+ options->msg_size[4] = ssize;
+ }
+ } break;
case 'u':
options->ublock_filename = opt_arg;
break;
case 'b':
- options->ublock_size = (hsize_t) HDatol( opt_arg );
+ options->ublock_size = (hsize_t)HDatol(opt_arg);
break;
case 'M':
- options->meta_block_size = (hsize_t) HDatol( opt_arg );
+ options->meta_block_size = (hsize_t)HDatol(opt_arg);
break;
case 't':
- options->threshold = (hsize_t) HDatol( opt_arg );
+ options->threshold = (hsize_t)HDatol(opt_arg);
break;
case 'a':
- options->alignment = HDstrtoull(opt_arg , NULL, 0);
+ options->alignment = HDstrtoull(opt_arg, NULL, 0);
if (options->alignment < 1) {
error_msg("invalid alignment size\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
@@ -598,30 +636,28 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
}
break;
- case 'S':
- {
- char strategy[MAX_NC_NAME];
-
- HDstrcpy(strategy, opt_arg);
- if (!HDstrcmp(strategy, "FSM_AGGR"))
- options->fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
- else if (!HDstrcmp(strategy, "PAGE"))
- options->fs_strategy = H5F_FSPACE_STRATEGY_PAGE;
- else if (!HDstrcmp(strategy, "AGGR"))
- options->fs_strategy = H5F_FSPACE_STRATEGY_AGGR;
- else if (!HDstrcmp(strategy, "NONE"))
- options->fs_strategy = H5F_FSPACE_STRATEGY_NONE;
- else {
- error_msg("invalid file space management strategy\n", opt_arg);
- h5tools_setstatus(EXIT_FAILURE);
- ret_value = -1;
- goto done;
- }
- if (options->fs_strategy == (H5F_fspace_strategy_t)0)
- /* To distinguish the "specified" zero value */
- options->fs_strategy = (H5F_fspace_strategy_t)-1;
+ case 'S': {
+ char strategy[MAX_NC_NAME];
+
+ HDstrcpy(strategy, opt_arg);
+ if (!HDstrcmp(strategy, "FSM_AGGR"))
+ options->fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
+ else if (!HDstrcmp(strategy, "PAGE"))
+ options->fs_strategy = H5F_FSPACE_STRATEGY_PAGE;
+ else if (!HDstrcmp(strategy, "AGGR"))
+ options->fs_strategy = H5F_FSPACE_STRATEGY_AGGR;
+ else if (!HDstrcmp(strategy, "NONE"))
+ options->fs_strategy = H5F_FSPACE_STRATEGY_NONE;
+ else {
+ error_msg("invalid file space management strategy\n", opt_arg);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
}
- break;
+ if (options->fs_strategy == (H5F_fspace_strategy_t)0)
+ /* To distinguish the "specified" zero value */
+ options->fs_strategy = (H5F_fspace_strategy_t)-1;
+ } break;
case 'P':
options->fs_persist = HDatoi(opt_arg);
@@ -641,7 +677,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
options->fs_pagesize = HDstrtoll(opt_arg, NULL, 0);
if (options->fs_pagesize == 0)
/* To distinguish the "specified" zero value */
- options->fs_pagesize = -1;
+ options->fs_pagesize = -1;
break;
case 'q':
@@ -669,12 +705,12 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
default:
break;
} /* end switch */
- } /* end while there are more options to parse */
+ } /* end while there are more options to parse */
/* If neither -i nor -o given, get in and out files positionally */
if (0 == (has_i + has_o)) {
if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) {
- infile = argv[opt_ind];
+ infile = argv[opt_ind];
outfile = argv[opt_ind + 1];
if (!HDstrcmp(infile, outfile)) {
@@ -712,10 +748,11 @@ done:
* Failure: EXIT_FAILURE(1)
*-------------------------------------------------------------------------
*/
-int main(int argc, const char **argv)
+int
+main(int argc, const char **argv)
{
- pack_opt_t options; /*the global options */
- int parse_ret;
+ pack_opt_t options; /*the global options */
+ int parse_ret;
HDmemset(&options, 0, sizeof(pack_opt_t));
@@ -777,4 +814,3 @@ done:
leave(h5tools_getstatus());
}
-
diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c
index 56fc12d..bb90b58 100644
--- a/tools/src/h5repack/h5repack_opttable.c
+++ b/tools/src/h5repack/h5repack_opttable.c
@@ -21,24 +21,25 @@
* Purpose: initialize a pack_info_t structure
*
* Return: void
- *-------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
-void init_packobject(pack_info_t *obj)
+void
+init_packobject(pack_info_t *obj)
{
int j, k;
HDstrcpy(obj->path, "\0");
for (j = 0; j < H5_REPACK_MAX_NFILTERS; j++) {
- obj->filter[j].filtn = -1;
+ obj->filter[j].filtn = -1;
obj->filter[j].cd_nelmts = CD_VALUES;
for (k = 0; k < CD_VALUES; k++)
obj->filter[j].cd_values[k] = 0;
}
obj->chunk.rank = -1;
- obj->refobj_id = -1;
- obj->layout = H5D_LAYOUT_ERROR;
- obj->nfilters = 0;
+ obj->refobj_id = -1;
+ obj->layout = H5D_LAYOUT_ERROR;
+ obj->nfilters = 0;
}
/*-------------------------------------------------------------------------
@@ -50,7 +51,8 @@ void init_packobject(pack_info_t *obj)
*-------------------------------------------------------------------------
*/
-static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_info_t filt)
+static void
+aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_info_t filt)
{
if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS)
table->objs[I].filter[table->objs[I].nfilters++] = filt;
@@ -66,7 +68,8 @@ static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_in
* Return: void
*-------------------------------------------------------------------------
*/
-static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info_t *pack)
+static void
+aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info_t *pack)
{
int k;
@@ -75,15 +78,14 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info
/* -2 means the NONE option, remove chunking
and set the layout to contiguous */
if (pack->chunk.rank == -2) {
- table->objs[I].layout = H5D_CONTIGUOUS;
+ table->objs[I].layout = H5D_CONTIGUOUS;
table->objs[I].chunk.rank = -2;
}
/* otherwise set the chunking type */
else {
table->objs[I].chunk.rank = pack->chunk.rank;
for (k = 0; k < pack->chunk.rank; k++)
- table->objs[I].chunk.chunk_lengths[k] =
- pack->chunk.chunk_lengths[k];
+ table->objs[I].chunk.chunk_lengths[k] = pack->chunk.chunk_lengths[k];
}
}
}
@@ -100,10 +102,10 @@ static int
aux_inctable(pack_opttbl_t *table, unsigned n_objs)
{
unsigned u;
- int ret_value = 0;
+ int ret_value = 0;
table->size += n_objs;
- table->objs = (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t));
+ table->objs = (pack_info_t *)HDrealloc(table->objs, table->size * sizeof(pack_info_t));
if (table->objs == NULL) {
H5TOOLS_INFO("not enough memory for options table");
ret_value = -1;
@@ -116,27 +118,28 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs)
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: options_table_init
*
* Purpose: init options table
*
* Return: 0, ok, -1, fail
- *-------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
-int options_table_init(pack_opttbl_t **tbl) {
- unsigned int i;
+int
+options_table_init(pack_opttbl_t **tbl)
+{
+ unsigned int i;
pack_opttbl_t *table;
- int ret_value = 0;
+ int ret_value = 0;
- if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) {
+ if (NULL == (table = (pack_opttbl_t *)HDmalloc(sizeof(pack_opttbl_t)))) {
H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table");
}
- table->size = 30;
+ table->size = 30;
table->nelems = 0;
- if (NULL == (table->objs = (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) {
+ if (NULL == (table->objs = (pack_info_t *)HDmalloc(table->size * sizeof(pack_info_t)))) {
HDfree(table);
H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table");
}
@@ -149,7 +152,6 @@ done:
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: options_table_free
*
@@ -159,7 +161,9 @@ done:
*-------------------------------------------------------------------------
*/
-int options_table_free(pack_opttbl_t *table) {
+int
+options_table_free(pack_opttbl_t *table)
+{
HDfree(table->objs);
HDfree(table);
return 0;
@@ -171,15 +175,15 @@ int options_table_free(pack_opttbl_t *table) {
* Purpose: add a layout option to the option list
*
* Return: 0, ok, -1, fail
- *-------------------------------------------------------------------------
+ *-------------------------------------------------------------------------
*/
int
-options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pack_opttbl_t *table)
+options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pack_opttbl_t *table)
{
unsigned i, j, I;
- unsigned added = 0;
- hbool_t found = FALSE;
- int ret_value = 0;
+ unsigned added = 0;
+ hbool_t found = FALSE;
+ int ret_value = 0;
/* increase the size of the collection by N_OBJS if necessary */
if (table->nelems + n_objs >= table->size)
@@ -193,7 +197,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa
/* linear table search */
for (i = 0; i < table->nelems; i++) {
/*already on the table */
- if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) {
+ if (HDstrcmp(obj_list[j].obj, table->objs[i].path) == 0) {
/* already chunk info inserted for this one; exit */
if (table->objs[i].chunk.rank > 0) {
H5TOOLS_INFO("chunk information already inserted for <%s>\n", obj_list[j].obj);
@@ -206,7 +210,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa
break;
}
} /* if */
- } /* i */
+ } /* i */
if (!found) {
/* keep the grow in a temp var */
@@ -220,14 +224,13 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa
-f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20
dset1 is already inserted, but dset2 must also be
*/
- else
- if(found && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) {
- /* keep the grow in a temp var */
- I = table->nelems + added;
- added++;
- HDstrcpy(table->objs[I].path, obj_list[j].obj);
- aux_tblinsert_layout(table, I, pack);
- }
+ else if (found && HDstrcmp(obj_list[j].obj, table->objs[i].path) != 0) {
+ /* keep the grow in a temp var */
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_layout(table, I, pack);
+ }
} /* j */
}
/* first time insertion */
@@ -258,8 +261,8 @@ int
options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pack_opttbl_t *table)
{
unsigned int i, j, I;
- unsigned added = 0;
- hbool_t found = FALSE;
+ unsigned added = 0;
+ hbool_t found = FALSE;
/* increase the size of the collection by N_OBJS if necessary */
if (table->nelems + n_objs >= table->size)
@@ -279,7 +282,7 @@ options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pa
found = TRUE;
break;
} /* if */
- } /* i */
+ } /* i */
if (!found) {
/* keep the grow in a temp var */
@@ -293,14 +296,13 @@ options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pa
-l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1
dset1 is already inserted, but dset2 must also be
*/
- else
- if(found && HDstrcmp(obj_list[j].obj,table->objs[i].path) != 0) {
- /* keep the grow in a temp var */
- I = table->nelems + added;
- added++;
- HDstrcpy(table->objs[I].path, obj_list[j].obj);
- aux_tblinsert_filter(table, I, filt);
- }
+ else if (found && HDstrcmp(obj_list[j].obj, table->objs[i].path) != 0) {
+ /* keep the grow in a temp var */
+ I = table->nelems + added;
+ added++;
+ HDstrcpy(table->objs[I].path, obj_list[j].obj);
+ aux_tblinsert_filter(table, I, filt);
+ }
} /* j */
}
@@ -329,9 +331,11 @@ options_add_filter(obj_list_t *obj_list, unsigned n_objs, filter_info_t filt, pa
*-------------------------------------------------------------------------
*/
-pack_info_t* options_get_object(const char *path, pack_opttbl_t *table) {
+pack_info_t *
+options_get_object(const char *path, pack_opttbl_t *table)
+{
unsigned int i;
- char tbl_path[MAX_NC_NAME + 1]; /* +1 for start with "/" case */
+ char tbl_path[MAX_NC_NAME + 1]; /* +1 for start with "/" case */
for (i = 0; i < table->nelems; i++) {
/* make full path (start with "/") to compare correctly */
diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c
index 50ccd7a..b02f2cf 100644
--- a/tools/src/h5repack/h5repack_parse.c
+++ b/tools/src/h5repack/h5repack_parse.c
@@ -37,8 +37,9 @@
* "A,B:NONE"
*-------------------------------------------------------------------------
*/
-obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
- pack_opt_t *options, int *is_glb) {
+obj_list_t *
+parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t *options, int *is_glb)
+{
size_t i, m, u;
char c;
size_t len = HDstrlen(str);
@@ -48,7 +49,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
char scomp[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
char stype[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
char smask[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- obj_list_t* obj_list = NULL;
+ obj_list_t *obj_list = NULL;
unsigned pixels_per_block;
/* initialize compression info */
@@ -59,7 +60,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
for (i = 0, n = 0; i < len; i++) {
c = str[i];
if (c == ':') {
- end_obj = (int) i;
+ end_obj = (int)i;
break;
}
if (c == ',')
@@ -71,13 +72,13 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
if (end_obj == -1) {
/* apply to all objects */
options->all_filter = 1;
- *is_glb = 1;
- *n_objs = 1;
+ *is_glb = 1;
+ *n_objs = 1;
}
else
*n_objs = n;
- obj_list = (obj_list_t *) HDmalloc(n * sizeof(obj_list_t));
+ obj_list = (obj_list_t *)HDmalloc(n * sizeof(obj_list_t));
if (obj_list == NULL) {
error_msg("could not allocate object list\n");
return NULL;
@@ -85,10 +86,10 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
/* get object list */
if (end_obj > 0)
- for (j = 0, k = 0, n = 0; j < (unsigned) end_obj; j++, k++) {
- c = str[j];
+ for (j = 0, k = 0, n = 0; j < (unsigned)end_obj; j++, k++) {
+ c = str[j];
sobj[k] = c;
- if (c == ',' || j == (unsigned) (end_obj - 1)) {
+ if (c == ',' || j == (unsigned)(end_obj - 1)) {
if (c == ',')
sobj[k] = '\0';
else
@@ -101,7 +102,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
/* nothing after : */
- if (end_obj + 1 == (int) len) {
+ if (end_obj + 1 == (int)len) {
if (obj_list)
HDfree(obj_list);
error_msg("input Error: Invalid compression type in <%s>\n", str);
@@ -111,25 +112,25 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
/* get filter additional parameters */
m = 0;
for (i = (size_t)(end_obj + 1), k = 0, j = 0; i < len; i++, k++) {
- c = str[i];
+ c = str[i];
scomp[k] = c;
if (c == '=' || i == len - 1) {
- if (c == '=') { /*one more parameter */
+ if (c == '=') { /*one more parameter */
scomp[k] = '\0'; /*cut space */
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP
- * szip has the format SZIP=<pixels per block,coding>
- * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN'
- * example SZIP=8,NN
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_SZIP
+ * szip has the format SZIP=<pixels per block,coding>
+ * pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN'
+ * example SZIP=8,NN
+ *-------------------------------------------------------------------------
+ */
if (HDstrcmp(scomp, "SZIP") == 0) {
l = -1; /* mask index check */
for (m = 0, u = i + 1; u < len; u++, m++) {
if (str[u] == ',') {
stype[m] = '\0'; /* end digit of szip */
- l = 0; /* start EC or NN search */
- u++; /* skip ',' */
+ l = 0; /* start EC or NN search */
+ u++; /* skip ',' */
}
c = str[u];
if (!HDisdigit(c) && l == -1) {
@@ -145,10 +146,10 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
l++;
if (l == 2) {
smask[l] = '\0';
- i = len - 1; /* end */
- if (HDstrcmp(smask,"NN") == 0)
+ i = len - 1; /* end */
+ if (HDstrcmp(smask, "NN") == 0)
filt->cd_values[j++] = H5_SZIP_NN_OPTION_MASK;
- else if (HDstrcmp(smask,"EC") == 0)
+ else if (HDstrcmp(smask, "EC") == 0)
filt->cd_values[j++] = H5_SZIP_EC_OPTION_MASK;
else {
error_msg("szip mask must be 'NN' or 'EC' \n");
@@ -157,29 +158,29 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
} /* u */
- } /*if */
+ } /*if */
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET
- * scaleoffset has the format SOFF=<scale_factor,scale_type>
- * scale_type can be
- * integer datatype, H5Z_SO_INT (IN)
- * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS)
- * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented
- * for integer datatypes, scale_factor denotes Minimum Bits
- * for float datatypes, scale_factor denotes decimal scale factor
- * examples
- * SOFF=31,IN
- * SOFF=3,DF
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_SCALEOFFSET
+ * scaleoffset has the format SOFF=<scale_factor,scale_type>
+ * scale_type can be
+ * integer datatype, H5Z_SO_INT (IN)
+ * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS)
+ * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented
+ * for integer datatypes, scale_factor denotes Minimum Bits
+ * for float datatypes, scale_factor denotes decimal scale factor
+ * examples
+ * SOFF=31,IN
+ * SOFF=3,DF
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "SOFF") == 0) {
l = -1; /* mask index check */
for (m = 0, u = i + 1; u < len; u++, m++) {
if (str[u] == ',') {
stype[m] = '\0'; /* end digit */
- l = 0; /* start 'IN' , 'DS', or 'ES' search */
- u++; /* skip ',' */
+ l = 0; /* start 'IN' , 'DS', or 'ES' search */
+ u++; /* skip ',' */
}
c = str[u];
if (!HDisdigit(c) && l == -1) {
@@ -195,8 +196,8 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
l++;
if (l == 2) {
smask[l] = '\0';
- i = len - 1; /* end */
- if (HDstrcmp(smask,"IN") == 0)
+ i = len - 1; /* end */
+ if (HDstrcmp(smask, "IN") == 0)
filt->cd_values[j++] = H5Z_SO_INT;
else if (HDstrcmp(smask, "DS") == H5Z_SO_FLOAT_DSCALE)
filt->cd_values[j++] = H5Z_SO_FLOAT_DSCALE;
@@ -207,15 +208,15 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
} /* u */
- } /*if */
+ } /*if */
/*-------------------------------------------------------------------------
- * User Defined
- * has the format UD=<filter_number,filter_flag,cd_value_count,value_1[,value_2,...,value_N]>
- * BZIP2 example
- * UD=307,0,1,9
- *-------------------------------------------------------------------------
- */
+ * User Defined
+ * has the format
+ *UD=<filter_number,filter_flag,cd_value_count,value_1[,value_2,...,value_N]> BZIP2 example
+ * UD=307,0,1,9
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "UD") == 0) {
l = -1; /* filter number index check */
f = -1; /* filter flag index check */
@@ -225,15 +226,15 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
stype[q] = '\0'; /* end digit */
if (l == -1) {
filt->filtn = HDatoi(stype);
- l = 0;
+ l = 0;
}
else if (f == -1) {
filt->filt_flag = (unsigned)HDstrtoul(stype, NULL, 0);
- f = 0;
+ f = 0;
}
else if (p == -1) {
filt->cd_nelmts = HDstrtoull(stype, NULL, 0);
- p = 0;
+ p = 0;
}
else {
filt->cd_values[j++] = (unsigned)HDstrtoul(stype, NULL, 0);
@@ -260,9 +261,9 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
} /*if */
/*-------------------------------------------------------------------------
- * all other filters
- *-------------------------------------------------------------------------
- */
+ * all other filters
+ *-------------------------------------------------------------------------
+ */
else {
/* here we could have 1 or 2 digits */
for (m = 0, u = i + 1; u < len; u++, m++) {
@@ -279,36 +280,36 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
stype[m] = '\0';
} /*if */
- filt->cd_values[j++] = (unsigned) HDstrtoul(stype, NULL, 0);
- if(filt->cd_nelmts == 0)
+ filt->cd_values[j++] = (unsigned)HDstrtoul(stype, NULL, 0);
+ if (filt->cd_nelmts == 0)
j = 0;
i += m; /* jump */
}
else if (i == len - 1) { /*no more parameters */
scomp[k + 1] = '\0';
- no_param = 1;
+ no_param = 1;
}
/*-------------------------------------------------------------------------
- * translate from string to filter symbol
- *-------------------------------------------------------------------------
- */
+ * translate from string to filter symbol
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5Z_FILTER_NONE
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_NONE
+ *-------------------------------------------------------------------------
+ */
if (HDstrcmp(scomp, "NONE") == 0) {
- filt->filtn = H5Z_FILTER_NONE;
+ filt->filtn = H5Z_FILTER_NONE;
filt->cd_nelmts = 0;
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_DEFLATE
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "GZIP") == 0) {
- filt->filtn = H5Z_FILTER_DEFLATE;
+ filt->filtn = H5Z_FILTER_DEFLATE;
filt->cd_nelmts = 1;
if (no_param) { /*no more parameters, GZIP must have parameter */
if (obj_list)
@@ -319,11 +320,11 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_SZIP
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "SZIP") == 0) {
- filt->filtn = H5Z_FILTER_SZIP;
+ filt->filtn = H5Z_FILTER_SZIP;
filt->cd_nelmts = 2;
if (no_param) { /*no more parameters, SZIP must have parameter */
if (obj_list)
@@ -334,11 +335,11 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SHUFFLE
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_SHUFFLE
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "SHUF") == 0) {
- filt->filtn = H5Z_FILTER_SHUFFLE;
+ filt->filtn = H5Z_FILTER_SHUFFLE;
filt->cd_nelmts = 0;
if (m > 0) { /*shuffle does not have parameter */
if (obj_list)
@@ -348,11 +349,11 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_FLETCHER32
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_FLETCHER32
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "FLET") == 0) {
- filt->filtn = H5Z_FILTER_FLETCHER32;
+ filt->filtn = H5Z_FILTER_FLETCHER32;
filt->cd_nelmts = 0;
if (m > 0) { /*shuffle does not have parameter */
if (obj_list)
@@ -362,11 +363,11 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_NBIT
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_NBIT
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "NBIT") == 0) {
- filt->filtn = H5Z_FILTER_NBIT;
+ filt->filtn = H5Z_FILTER_NBIT;
filt->cd_nelmts = 0;
if (m > 0) { /*nbit does not have parameter */
if (obj_list)
@@ -376,11 +377,11 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SCALEOFFSET
- *-------------------------------------------------------------------------
- */
+ * H5Z_FILTER_SCALEOFFSET
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "SOFF") == 0) {
- filt->filtn = H5Z_FILTER_SCALEOFFSET;
+ filt->filtn = H5Z_FILTER_SCALEOFFSET;
filt->cd_nelmts = 2;
if (no_param) { /*no more parameters, SOFF must have parameter */
if (obj_list)
@@ -390,9 +391,9 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
}
}
/*-------------------------------------------------------------------------
- * User Defined Filter
- *-------------------------------------------------------------------------
- */
+ * User Defined Filter
+ *-------------------------------------------------------------------------
+ */
else if (HDstrcmp(scomp, "UD") == 0) {
/* parameters does not match count */
if (filt->cd_nelmts != j) {
@@ -413,56 +414,55 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
} /*i*/
/*-------------------------------------------------------------------------
- * check valid parameters
- *-------------------------------------------------------------------------
- */
+ * check valid parameters
+ *-------------------------------------------------------------------------
+ */
switch (filt->filtn) {
- /*-------------------------------------------------------------------------
- * H5Z_FILTER_DEFLATE
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_DEFLATE:
- if (filt->cd_values[0] > 9) {
- if (obj_list)
- HDfree(obj_list);
- error_msg("invalid compression parameter in <%s>\n", str);
- HDexit(EXIT_FAILURE);
- }
- break;
/*-------------------------------------------------------------------------
- * H5Z_FILTER_SZIP
- *-------------------------------------------------------------------------
- */
- case H5Z_FILTER_SZIP:
- pixels_per_block = filt->cd_values[0];
- if ((pixels_per_block % 2) == 1) {
- if (obj_list)
- HDfree(obj_list);
- error_msg("pixels_per_block is not even in <%s>\n", str);
- HDexit(EXIT_FAILURE);
- }
- if (pixels_per_block > H5_SZIP_MAX_PIXELS_PER_BLOCK) {
- if (obj_list)
- HDfree(obj_list);
- error_msg("pixels_per_block is too large in <%s>\n", str);
- HDexit(EXIT_FAILURE);
- }
- if ((HDstrcmp(smask,"NN") != 0) && (HDstrcmp(smask,"EC") != 0)) {
- if (obj_list)
- HDfree(obj_list);
- error_msg("szip mask must be 'NN' or 'EC' \n");
- HDexit(EXIT_FAILURE);
- }
- break;
- default:
- break;
+ * H5Z_FILTER_DEFLATE
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_DEFLATE:
+ if (filt->cd_values[0] > 9) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("invalid compression parameter in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ break;
+ /*-------------------------------------------------------------------------
+ * H5Z_FILTER_SZIP
+ *-------------------------------------------------------------------------
+ */
+ case H5Z_FILTER_SZIP:
+ pixels_per_block = filt->cd_values[0];
+ if ((pixels_per_block % 2) == 1) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("pixels_per_block is not even in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ if (pixels_per_block > H5_SZIP_MAX_PIXELS_PER_BLOCK) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("pixels_per_block is too large in <%s>\n", str);
+ HDexit(EXIT_FAILURE);
+ }
+ if ((HDstrcmp(smask, "NN") != 0) && (HDstrcmp(smask, "EC") != 0)) {
+ if (obj_list)
+ HDfree(obj_list);
+ error_msg("szip mask must be 'NN' or 'EC' \n");
+ HDexit(EXIT_FAILURE);
+ }
+ break;
+ default:
+ break;
};
return obj_list;
}
-
/*-------------------------------------------------------------------------
* Function: parse_layout
*
@@ -484,9 +484,11 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
*
*-------------------------------------------------------------------------
*/
-obj_list_t* parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about layout needed */
-pack_opt_t *options) {
- obj_list_t* obj_list = NULL;
+obj_list_t *
+parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about layout needed */
+ pack_opt_t *options)
+{
+ obj_list_t *obj_list = NULL;
unsigned i, j, n;
char c;
size_t len = HDstrlen(str);
@@ -503,7 +505,7 @@ pack_opt_t *options) {
for (i = 0, n = 0; i < len; i++) {
c = str[i];
if (c == ':')
- end_obj = (int) i;
+ end_obj = (int)i;
if (c == ',')
n++;
}
@@ -513,7 +515,7 @@ pack_opt_t *options) {
}
n++;
- obj_list = (obj_list_t*) HDmalloc(n * sizeof(obj_list_t));
+ obj_list = (obj_list_t *)HDmalloc(n * sizeof(obj_list_t));
if (obj_list == NULL) {
error_msg("could not allocate object list\n");
return NULL;
@@ -522,10 +524,10 @@ pack_opt_t *options) {
/* get object list */
if (end_obj > 0)
- for (j = 0, k = 0, n = 0; j < (unsigned) end_obj; j++, k++) {
- c = str[j];
+ for (j = 0, k = 0, n = 0; j < (unsigned)end_obj; j++, k++) {
+ c = str[j];
sobj[k] = c;
- if (c == ',' || j == (unsigned) (end_obj - 1)) {
+ if (c == ',' || j == (unsigned)(end_obj - 1)) {
if (c == ',')
sobj[k] = '\0';
else
@@ -538,7 +540,7 @@ pack_opt_t *options) {
}
/* nothing after : */
- if (end_obj + 1 == (int) len) {
+ if (end_obj + 1 == (int)len) {
if (obj_list)
HDfree(obj_list);
error_msg("in parse layout, no characters after : in <%s>\n", str);
@@ -546,7 +548,7 @@ pack_opt_t *options) {
}
/* get layout info */
- for (j = (unsigned) (end_obj + 1), n = 0; n <= 5; j++, n++) {
+ for (j = (unsigned)(end_obj + 1), n = 0; n <= 5; j++, n++) {
if (n == 5) {
slayout[n] = '\0'; /*cut string */
if (HDstrcmp(slayout, "COMPA") == 0)
@@ -561,16 +563,16 @@ pack_opt_t *options) {
}
}
else {
- c = str[j];
+ c = str[j];
slayout[n] = c;
}
} /* j */
if (pack->layout == H5D_CHUNKED) {
/*-------------------------------------------------------------------------
- * get chunk info
- *-------------------------------------------------------------------------
- */
+ * get chunk info
+ *-------------------------------------------------------------------------
+ */
k = 0;
if (j > len) {
if (obj_list)
@@ -580,7 +582,7 @@ pack_opt_t *options) {
}
for (i = j, c_index = 0; i < len; i++) {
- c = str[i];
+ c = str[i];
sdim[k] = c;
k++; /*increment sdim index */
@@ -593,8 +595,8 @@ pack_opt_t *options) {
if (c == 'x' || i == len - 1) {
if (c == 'x') {
- sdim[k - 1] = '\0';
- k = 0;
+ sdim[k - 1] = '\0';
+ k = 0;
pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0);
if (pack->chunk.chunk_lengths[c_index] == 0) {
if (obj_list)
@@ -606,8 +608,8 @@ pack_opt_t *options) {
}
else if (i == len - 1) { /*no more parameters */
sdim[k] = '\0';
- k = 0;
- if (HDstrcmp(sdim,"NONE") == 0) {
+ k = 0;
+ if (HDstrcmp(sdim, "NONE") == 0) {
pack->chunk.rank = -2;
}
else {
@@ -621,9 +623,9 @@ pack_opt_t *options) {
pack->chunk.rank = c_index + 1;
}
} /*if */
- } /*if c=='x' || i==len-1 */
- } /*i*/
- } /*H5D_CHUNKED*/
+ } /*if c=='x' || i==len-1 */
+ } /*i*/
+ } /*H5D_CHUNKED*/
return obj_list;
}
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index ee17ed8..5eba963 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -15,17 +15,15 @@
#include "h5diff.h"
#include "h5tools.h"
-
/*-------------------------------------------------------------------------
* local functions
*-------------------------------------------------------------------------
*/
-static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt);
-static int copy_refs_attr(hid_t loc_in, hid_t loc_out,
- trav_table_t *travt, hid_t fidout);
-static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
- hid_t fid_out, void *ref_out, trav_table_t *travt);
+static const char *MapIdToName(hid_t refobj_id, trav_table_t *travt);
+static int copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout);
+static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, hid_t fid_out, void *ref_out,
+ trav_table_t *travt);
/*-------------------------------------------------------------------------
* Function: do_copy_refobjs
@@ -37,35 +35,33 @@ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
*-------------------------------------------------------------------------
*/
-int do_copy_refobjs(hid_t fidin,
- hid_t fidout,
- trav_table_t *travt,
- pack_opt_t *options) /* repack options */
+int
+do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *options) /* repack options */
{
- hid_t grp_in = H5I_INVALID_HID; /* read group ID */
- hid_t grp_out = H5I_INVALID_HID; /* write group ID */
- hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */
- hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */
- hid_t type_in = H5I_INVALID_HID; /* named type ID */
- hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t space_id = H5I_INVALID_HID; /* space ID */
- hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */
- hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */
- size_t msize; /* memory size of memory type */
- hsize_t nelmts; /* number of elements in dataset */
- int rank; /* rank of dataset */
- hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
+ hid_t grp_in = H5I_INVALID_HID; /* read group ID */
+ hid_t grp_out = H5I_INVALID_HID; /* write group ID */
+ hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */
+ hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */
+ hid_t type_in = H5I_INVALID_HID; /* named type ID */
+ hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t space_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */
+ size_t msize; /* memory size of memory type */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
unsigned int i, j;
- int k;
- named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
- int ret_value = 0;
+ int k;
+ named_dt_t * named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
+ int ret_value = 0;
/*-------------------------------------------------------------------------
- * browse
- *-------------------------------------------------------------------------
- */
- for(i = 0; i < travt->nobjs; i++) {
- switch(travt->objs[i].type) {
+ * browse
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0; i < travt->nobjs; i++) {
+ switch (travt->objs[i].type) {
/*-------------------------------------------------------------------------
* H5TRAV_TYPE_GROUP
*-------------------------------------------------------------------------
@@ -75,27 +71,28 @@ int do_copy_refobjs(hid_t fidin,
* copy referenced objects in attributes
*-------------------------------------------------------------------------
*/
- if((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ if ((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed");
- if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed");
- if(copy_refs_attr(grp_in, grp_out, travt, fidout) < 0)
+ if (copy_refs_attr(grp_in, grp_out, travt, fidout) < 0)
H5TOOLS_GOTO_ERROR((-1), "copy_refs_attr failed");
- if(H5Gclose(grp_out) < 0)
+ if (H5Gclose(grp_out) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
- if(H5Gclose(grp_in) < 0)
+ if (H5Gclose(grp_in) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
/*-------------------------------------------------------------------------
* check for hard links
*-------------------------------------------------------------------------
*/
- if(travt->objs[i].nlinks)
- for(j = 0; j < travt->objs[i].nlinks; j++)
- H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
+ if (travt->objs[i].nlinks)
+ for (j = 0; j < travt->objs[i].nlinks; j++)
+ H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC,
+ travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
break;
/*-------------------------------------------------------------------------
@@ -103,26 +100,26 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
case H5TRAV_TYPE_DATASET:
- if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
- if((space_id = H5Dget_space(dset_in)) < 0)
+ if ((space_id = H5Dget_space(dset_in)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
- if((ftype_id = H5Dget_type(dset_in)) < 0)
+ if ((ftype_id = H5Dget_type(dset_in)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
- if((dcpl_id = H5Dget_create_plist(dset_in)) < 0)
+ if ((dcpl_id = H5Dget_create_plist(dset_in)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
- if((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
+ if ((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_ndims failed");
- if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(space_id, dims, NULL) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed");
nelmts = 1;
- for(k = 0; k < rank; k++)
+ for (k = 0; k < rank; k++)
nelmts *= dims[k];
- if((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0)
+ if ((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_native_type failed");
- if((msize = H5Tget_size(mtype_id)) == 0)
+ if ((msize = H5Tget_size(mtype_id)) == 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed");
/*-------------------------------------------------------------------------
@@ -132,7 +129,7 @@ int do_copy_refobjs(hid_t fidin,
* 2) the internal filters might be turned off
*-------------------------------------------------------------------------
*/
- if(h5tools_canreadf(NULL, dcpl_id) == 1) {
+ if (h5tools_canreadf(NULL, dcpl_id) == 1) {
/*-------------------------------------------------------------------------
* test for a valid output dataset
*-------------------------------------------------------------------------
@@ -144,75 +141,78 @@ int do_copy_refobjs(hid_t fidin,
* we cannot just copy the buffers, but instead we recreate the reference
*-------------------------------------------------------------------------
*/
- if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) {
- hid_t refobj_id = H5I_INVALID_HID;
- hobj_ref_t *refbuf = NULL; /* buffer for object references */
- hobj_ref_t *buf = NULL;
- const char* refname;
- unsigned u;
+ if (H5Tequal(mtype_id, H5T_STD_REF_OBJ)) {
+ hid_t refobj_id = H5I_INVALID_HID;
+ hobj_ref_t *refbuf = NULL; /* buffer for object references */
+ hobj_ref_t *buf = NULL;
+ const char *refname;
+ unsigned u;
/*-------------------------------------------------------------------------
* read to memory
*-------------------------------------------------------------------------
*/
- if(nelmts) {
+ if (nelmts) {
buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize));
- if(buf==NULL) {
- HDprintf("cannot read into memory\n" );
+ if (buf == NULL) {
+ HDprintf("cannot read into memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
- if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
- refbuf = (hobj_ref_t*) HDcalloc((unsigned)nelmts, msize);
- if(refbuf == NULL){
- HDprintf("cannot allocate memory\n" );
+ refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize);
+ if (refbuf == NULL) {
+ HDprintf("cannot allocate memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed");
} /* end if */
- for(u = 0; u < nelmts; u++) {
- H5E_BEGIN_TRY {
- if((refobj_id = H5Rdereference2(dset_in, H5P_DEFAULT, H5R_OBJECT, &buf[u])) < 0)
+ for (u = 0; u < nelmts; u++) {
+ H5E_BEGIN_TRY
+ {
+ if ((refobj_id =
+ H5Rdereference2(dset_in, H5P_DEFAULT, H5R_OBJECT, &buf[u])) < 0)
continue;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* get the name. a valid name could only occur
* in the second traversal of the file
*/
- if((refname = MapIdToName(refobj_id, travt)) != NULL) {
+ if ((refname = MapIdToName(refobj_id, travt)) != NULL) {
/* create the reference, -1 parameter for objects */
- if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0)
+ if (H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Rcreate failed");
- if(options->verbose) {
- HDprintf(FORMAT_OBJ,"dset",travt->objs[i].name );
+ if (options->verbose) {
+ HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
HDprintf("object <%s> object reference created to <%s>\n",
- travt->objs[i].name,
- refname);
+ travt->objs[i].name, refname);
}
} /*refname*/
if (H5Oclose(refobj_id) < 0)
H5TOOLS_ERROR((-1), "H5Oclose refob failed");
} /* u */
- } /*nelmts*/
+ } /*nelmts*/
/*-------------------------------------------------------------------------
* create/write dataset/close
*-------------------------------------------------------------------------
*/
- if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id,
+ H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dcreate2 failed");
- if(nelmts)
- if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
+ if (nelmts)
+ if (H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
- if(buf)
+ if (buf)
HDfree(buf);
- if(refbuf)
+ if (refbuf)
HDfree(refbuf);
- /*------------------------------------------------------
- * copy attrs
- *----------------------------------------------------*/
- if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ /*------------------------------------------------------
+ * copy attrs
+ *----------------------------------------------------*/
+ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
} /*H5T_STD_REF_OBJ*/
@@ -220,87 +220,93 @@ int do_copy_refobjs(hid_t fidin,
* dataset region references
*-------------------------------------------------------------------------
*/
- else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) {
+ else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) {
hid_t refobj_id = H5I_INVALID_HID;
- hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
- hdset_reg_ref_t *buf = NULL; /* output buffer */
- const char* refname;
+ hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
+ hdset_reg_ref_t *buf = NULL; /* output buffer */
+ const char * refname;
unsigned u;
/*-------------------------------------------------------------------------
* read input to memory
*-------------------------------------------------------------------------
*/
- if(nelmts) {
+ if (nelmts) {
buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize));
- if(buf == NULL) {
+ if (buf == NULL) {
HDprintf("cannot read into memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
- if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dread failed");
/*-------------------------------------------------------------------------
* create output
*-------------------------------------------------------------------------
*/
- refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
- if(refbuf == NULL) {
+ refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t),
+ (size_t)nelmts); /*init to zero */
+ if (refbuf == NULL) {
HDprintf("cannot allocate memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed");
} /* end if */
- for(u = 0; u < nelmts; u++) {
- H5E_BEGIN_TRY {
- if((refobj_id = H5Rdereference2(dset_in, H5P_DEFAULT, H5R_DATASET_REGION, &buf[u])) < 0)
+ for (u = 0; u < nelmts; u++) {
+ H5E_BEGIN_TRY
+ {
+ if ((refobj_id = H5Rdereference2(dset_in, H5P_DEFAULT, H5R_DATASET_REGION,
+ &buf[u])) < 0)
continue;
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
/* get the name. a valid name could only occur
* in the second traversal of the file
*/
- if((refname = MapIdToName(refobj_id, travt)) != NULL) {
- hid_t region_id = H5I_INVALID_HID; /* region id of the referenced dataset */
+ if ((refname = MapIdToName(refobj_id, travt)) != NULL) {
+ hid_t region_id =
+ H5I_INVALID_HID; /* region id of the referenced dataset */
- if((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0)
+ if ((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Rget_region failed");
/* create the reference, we need the space_id */
- if(H5Rcreate(&refbuf[u], fidout, refname, H5R_DATASET_REGION, region_id) < 0)
+ if (H5Rcreate(&refbuf[u], fidout, refname, H5R_DATASET_REGION,
+ region_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Rcreate failed");
- if(H5Sclose(region_id) < 0)
+ if (H5Sclose(region_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
- if(options->verbose) {
- HDprintf(FORMAT_OBJ,"dset",travt->objs[i].name );
+ if (options->verbose) {
+ HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
HDprintf("object <%s> region reference created to <%s>\n",
- travt->objs[i].name,
- refname);
+ travt->objs[i].name, refname);
}
} /*refname*/
if (H5Oclose(refobj_id) < 0)
H5TOOLS_ERROR((-1), "H5Oclose refobj_id failed");
} /* u */
- } /*nelmts*/
+ } /*nelmts*/
/*-------------------------------------------------------------------------
* create/write dataset/close
*-------------------------------------------------------------------------
*/
- if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
+ if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id,
+ H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dcreate2 failed");
- if(nelmts)
- if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
+ if (nelmts)
+ if (H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed");
- if(buf)
+ if (buf)
HDfree(buf);
- if(refbuf)
+ if (refbuf)
HDfree(refbuf);
- /*-----------------------------------------------------
- * copy attrs
- *----------------------------------------------------*/
- if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ /*-----------------------------------------------------
+ * copy attrs
+ *----------------------------------------------------*/
+ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
H5TOOLS_GOTO_ERROR((-1), "copy_attr failed");
} /* H5T_STD_REF_DSETREG */
/*-------------------------------------------------------------------------
@@ -308,7 +314,7 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
else {
- if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed");
} /* end else */
@@ -316,18 +322,19 @@ int do_copy_refobjs(hid_t fidin,
* copy referenced objects in attributes
*-------------------------------------------------------------------------
*/
- if(copy_refs_attr(dset_in, dset_out, travt, fidout) < 0)
+ if (copy_refs_attr(dset_in, dset_out, travt, fidout) < 0)
H5TOOLS_GOTO_ERROR((-1), "copy_refs_attr failed");
/*-------------------------------------------------------------------------
* check for hard links
*-------------------------------------------------------------------------
*/
- if(travt->objs[i].nlinks)
- for(j = 0; j < travt->objs[i].nlinks; j++)
- H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
+ if (travt->objs[i].nlinks)
+ for (j = 0; j < travt->objs[i].nlinks; j++)
+ H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC,
+ travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
- if(H5Dclose(dset_out) < 0)
+ if (H5Dclose(dset_out) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
} /*can_read*/
@@ -335,15 +342,15 @@ int do_copy_refobjs(hid_t fidin,
* close
*-------------------------------------------------------------------------
*/
- if(H5Tclose(ftype_id) < 0)
+ if (H5Tclose(ftype_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if(H5Tclose(mtype_id) < 0)
+ if (H5Tclose(mtype_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if(H5Pclose(dcpl_id) < 0)
+ if (H5Pclose(dcpl_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if(H5Sclose(space_id) < 0)
+ if (H5Sclose(space_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
- if(H5Dclose(dset_in) < 0)
+ if (H5Dclose(dset_in) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
break;
@@ -352,9 +359,9 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
case H5TRAV_TYPE_NAMED_DATATYPE:
- if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Topen2 failed");
- if(H5Tclose(type_in) < 0)
+ if (H5Tclose(type_in) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
break;
@@ -374,7 +381,7 @@ int do_copy_refobjs(hid_t fidin,
default:
break;
} /* end switch */
- } /* end for */
+ } /* end for */
/* Finalize (link) the stack of named datatypes (if any)
* This function is paired with copy_named_datatype() which is called
@@ -386,7 +393,8 @@ int do_copy_refobjs(hid_t fidin,
return ret_value;
done:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(grp_in);
H5Gclose(grp_out);
H5Pclose(dcpl_id);
@@ -397,12 +405,12 @@ done:
H5Tclose(mtype_id);
H5Tclose(type_in);
named_datatype_free(&named_dt_head, 1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: copy_refs_attr
*
@@ -425,91 +433,87 @@ done:
*-------------------------------------------------------------------------
*/
-static int copy_refs_attr(hid_t loc_in,
- hid_t loc_out,
- trav_table_t *travt,
- hid_t fidout) /* for saving references */
+static int
+copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) /* for saving references */
{
- hid_t attr_id = H5I_INVALID_HID; /* attr ID */
- hid_t attr_out = H5I_INVALID_HID; /* attr ID */
- hid_t space_id = H5I_INVALID_HID; /* space ID */
- hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */
- hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */
- size_t msize; /* memory size of type */
- hsize_t nelmts; /* number of elements in dataset */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ hid_t attr_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr_out = H5I_INVALID_HID; /* attr ID */
+ hid_t space_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */
+ size_t msize; /* memory size of type */
+ hsize_t nelmts; /* number of elements in dataset */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */
char name[255];
- H5O_info_t oinfo; /* Object info */
+ H5O_info_t oinfo; /* Object info */
unsigned u, i, j;
int rank;
H5T_class_t type_class = -1;
- hbool_t is_ref = 0,
- is_ref_vlen = 0,
- is_ref_array = 0,
- is_ref_comp = 0;
- void *refbuf = NULL;
- void *buf = NULL;
- unsigned *ref_comp_index = NULL;
- size_t *ref_comp_size = NULL;
+ hbool_t is_ref = 0, is_ref_vlen = 0, is_ref_array = 0, is_ref_comp = 0;
+ void * refbuf = NULL;
+ void * buf = NULL;
+ unsigned * ref_comp_index = NULL;
+ size_t * ref_comp_size = NULL;
int ref_comp_field_n = 0;
- int ret_value = 0;
+ int ret_value = 0;
- if(H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ if (H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed");
- for(u = 0; u < (unsigned)oinfo.num_attrs; u++) {
+ for (u = 0; u < (unsigned)oinfo.num_attrs; u++) {
is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0;
/* open attribute */
- if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT,
+ H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aopen_by_idx failed");
/* get the file datatype */
- if((ftype_id = H5Aget_type(attr_id)) < 0)
+ if ((ftype_id = H5Aget_type(attr_id)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aget_type failed");
type_class = H5Tget_class(ftype_id);
- if((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0)
+ if ((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_native_type failed");
- if((msize = H5Tget_size(mtype_id)) == 0)
+ if ((msize = H5Tget_size(mtype_id)) == 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed");
is_ref = (type_class == H5T_REFERENCE);
- if(type_class == H5T_VLEN ) {
+ if (type_class == H5T_VLEN) {
hid_t base_type = H5Tget_super(ftype_id);
is_ref_vlen = (H5Tget_class(base_type) == H5T_REFERENCE);
- msize = H5Tget_size(base_type);
+ msize = H5Tget_size(base_type);
if (H5Tclose(base_type) < 0)
H5TOOLS_ERROR((-1), "H5Tclose base_type failed");
}
- else if(type_class == H5T_ARRAY ) {
+ else if (type_class == H5T_ARRAY) {
hid_t base_type = H5Tget_super(ftype_id);
is_ref_array = (H5Tget_class(base_type) == H5T_REFERENCE);
- msize = H5Tget_size(base_type);
+ msize = H5Tget_size(base_type);
if (H5Tclose(base_type) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose base_type failed");
}
- else if(type_class == H5T_COMPOUND) {
- int nmembers = H5Tget_nmembers(ftype_id) ;
+ else if (type_class == H5T_COMPOUND) {
+ int nmembers = H5Tget_nmembers(ftype_id);
if (nmembers < 1)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_nmembers failed");
- ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers*sizeof(unsigned));
- ref_comp_size = (size_t *)HDmalloc((size_t)nmembers*sizeof(ref_comp_size));
+ ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers * sizeof(unsigned));
+ ref_comp_size = (size_t *)HDmalloc((size_t)nmembers * sizeof(ref_comp_size));
ref_comp_field_n = 0;
- for (i=0; i<(unsigned)nmembers; i++) {
+ for (i = 0; i < (unsigned)nmembers; i++) {
hid_t mtid = H5Tget_member_type(ftype_id, i);
if ((H5Tget_class(mtid) == H5T_REFERENCE)) {
ref_comp_index[ref_comp_field_n] = i;
- ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid);
+ ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid);
ref_comp_field_n++;
}
if (H5Tclose(mtid) < 0)
@@ -539,7 +543,6 @@ static int copy_refs_attr(hid_t loc_in,
is_ref_comp = (ref_comp_field_n > 0);
}
-
if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) {
if (H5Tclose(mtype_id) < 0)
H5TOOLS_ERROR((-1), "H5Tclose mtype_id failed");
@@ -551,31 +554,30 @@ static int copy_refs_attr(hid_t loc_in,
}
/* get name */
- if(H5Aget_name(attr_id, 255, name) < 0)
+ if (H5Aget_name(attr_id, 255, name) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aget_name failed");
/* get the dataspace handle */
- if((space_id = H5Aget_space(attr_id)) < 0)
+ if ((space_id = H5Aget_space(attr_id)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aget_space failed");
/* get dimensions */
- if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0)
+ if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sget_simple_extent_dims failed");
-
/*-------------------------------------------------------------------------
- * elements
- *-------------------------------------------------------------------------
- */
+ * elements
+ *-------------------------------------------------------------------------
+ */
nelmts = 1;
- for(j = 0; j < (unsigned)rank; j++)
+ for (j = 0; j < (unsigned)rank; j++)
nelmts *= dims[j];
if (is_ref_array) {
- unsigned array_rank = 0;
- hsize_t array_size = 1;
- hsize_t array_dims[H5S_MAX_RANK];
- hid_t base_type = H5Tget_super(ftype_id);
+ unsigned array_rank = 0;
+ hsize_t array_size = 1;
+ hsize_t array_dims[H5S_MAX_RANK];
+ hid_t base_type = H5Tget_super(ftype_id);
msize = H5Tget_size(base_type);
if (H5Tclose(base_type) < 0)
@@ -583,153 +585,163 @@ static int copy_refs_attr(hid_t loc_in,
array_rank = (unsigned)H5Tget_array_ndims(mtype_id);
H5Tget_array_dims2(mtype_id, array_dims);
- for(j = 0; j <array_rank; j++)
+ for (j = 0; j < array_rank; j++)
array_size *= array_dims[j];
nelmts *= array_size;
}
- if((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Acreate2 failed");
- if (nelmts>0) {
+ if (nelmts > 0) {
/* handle object references */
- if((is_ref || is_ref_array) && (H5R_OBJ_REF_BUF_SIZE==msize)) {
+ if ((is_ref || is_ref_array) && (H5R_OBJ_REF_BUF_SIZE == msize)) {
buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize));
- if(buf == NULL) {
+ if (buf == NULL) {
HDprintf("cannot read into memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
- if(H5Aread(attr_id, mtype_id, buf) < 0)
+ if (H5Aread(attr_id, mtype_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aread failed");
refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize);
- if(refbuf == NULL) {
+ if (refbuf == NULL) {
HDprintf("cannot allocate memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed");
} /* end if */
- for(i = 0; i < (unsigned)nelmts; i++)
- if(update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt) < 0)
+ for (i = 0; i < (unsigned)nelmts; i++)
+ if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout,
+ &((hobj_ref_t *)refbuf)[i], travt) < 0)
continue;
} /* H5T_STD_REF_OBJ */
/* handle region references */
- else if((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) {
+ else if ((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) {
buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize));
- if(buf == NULL) {
- HDprintf( "cannot read into memory\n" );
+ if (buf == NULL) {
+ HDprintf("cannot read into memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
- if(H5Aread(attr_id, mtype_id, buf) < 0)
+ if (H5Aread(attr_id, mtype_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aread failed");
/*-------------------------------------------------------------------------
* create output
*-------------------------------------------------------------------------
*/
- refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
- if(refbuf == NULL) {
- HDprintf( "cannot allocate memory\n" );
+ refbuf =
+ (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
+ if (refbuf == NULL) {
+ HDprintf("cannot allocate memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed");
} /* end if */
- for(i = 0; i < (unsigned)nelmts; i++)
- if(update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt) < 0)
+ for (i = 0; i < (unsigned)nelmts; i++)
+ if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout,
+ &((hdset_reg_ref_t *)refbuf)[i], travt) < 0)
continue;
} /* H5T_STD_REF_DSETREG */
else if (is_ref_vlen) {
/* handle VLEN of references */
- buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t)));
+ buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t)));
refbuf = buf; /* reuse the read buffer for write */
- if(buf == NULL) {
- HDprintf( "cannot read into memory\n" );
+ if (buf == NULL) {
+ HDprintf("cannot read into memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
- if(H5Aread(attr_id, mtype_id, buf) < 0)
+ if (H5Aread(attr_id, mtype_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aread failed");
- if (H5R_OBJ_REF_BUF_SIZE==msize) {
+ if (H5R_OBJ_REF_BUF_SIZE == msize) {
hobj_ref_t ref_out;
- for (i=0; i<(unsigned)nelmts; i++) {
+ for (i = 0; i < (unsigned)nelmts; i++) {
hobj_ref_t *ptr = (hobj_ref_t *)((hvl_t *)buf)[i].p;
- for (j=0; j<((hvl_t *)buf)[i].len; j++ ) {
- if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt)<0)
+ for (j = 0; j < ((hvl_t *)buf)[i].len; j++) {
+ if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt) < 0)
continue;
HDmemcpy(&(ptr[j]), &ref_out, msize);
}
- } /* for (i=0; i<nelems; i++) */
+ } /* for (i=0; i<nelems; i++) */
}
else if (H5R_DSET_REG_REF_BUF_SIZE == msize) {
hdset_reg_ref_t ref_out;
- for (i=0; i<(unsigned)nelmts; i++) {
+ for (i = 0; i < (unsigned)nelmts; i++) {
hdset_reg_ref_t *ptr = (hdset_reg_ref_t *)((hvl_t *)buf)[i].p;
- for (j=0; j<((hvl_t *)buf)[i].len; j++ ) {
- if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt)<0)
+ for (j = 0; j < ((hvl_t *)buf)[i].len; j++) {
+ if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out,
+ travt) < 0)
continue;
HDmemcpy(&(ptr[j]), &ref_out, msize);
}
- } /* for (i=0; i<nelems; i++) */
+ } /* for (i=0; i<nelems; i++) */
}
} /* else if (is_ref_vlen) */
else if (is_ref_comp) {
/* handle ref fields in a compound */
- buf = HDmalloc((unsigned)(nelmts * msize));
+ buf = HDmalloc((unsigned)(nelmts * msize));
refbuf = buf; /* reuse the read buffer for write */
- if(buf == NULL) {
- HDprintf( "cannot read into memory\n" );
+ if (buf == NULL) {
+ HDprintf("cannot read into memory\n");
H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed");
} /* end if */
- if(H5Aread(attr_id, mtype_id, buf) < 0)
+ if (H5Aread(attr_id, mtype_id, buf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aread failed");
- for (i=0; i<(unsigned)nelmts; i++) {
- for (j=0; j<(unsigned)ref_comp_field_n; j++) {
+ for (i = 0; i < (unsigned)nelmts; i++) {
+ for (j = 0; j < (unsigned)ref_comp_field_n; j++) {
if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) {
- size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]);
+ size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]);
hobj_ref_t ref_out;
- if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)((void *)(((char *)buf)+idx)), fidout, &ref_out, travt) < 0) /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */
+ if (update_ref_value(attr_id, H5R_OBJECT,
+ (hobj_ref_t *)((void *)(((char *)buf) + idx)), fidout,
+ &ref_out,
+ travt) < 0) /* Extra (void *) cast to quiet "cast to create
+ alignment" warning - 2019/07/05, QAK */
continue;
- HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]);
+ HDmemcpy(((char *)buf) + idx, &ref_out, ref_comp_size[j]);
} /* if */
else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) {
size_t idx = i * msize + H5Tget_member_offset(mtype_id, ref_comp_index[j]);
hdset_reg_ref_t ref_out;
- if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0)
+ if (update_ref_value(attr_id, H5R_DATASET_REGION,
+ (hdset_reg_ref_t *)(((char *)buf) + idx), fidout, &ref_out,
+ travt) < 0)
continue;
- HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]);
+ HDmemcpy(((char *)buf) + idx, &ref_out, ref_comp_size[j]);
} /* else if */
- } /* j */
- } /* i */
- } /* else if (is_ref_comp) */
+ } /* j */
+ } /* i */
+ } /* else if (is_ref_comp) */
- if(H5Awrite(attr_out, mtype_id, refbuf) < 0)
+ if (H5Awrite(attr_out, mtype_id, refbuf) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Awrite failed");
if (is_ref_vlen && buf)
- H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf);
+ H5Dvlen_reclaim(mtype_id, space_id, H5P_DEFAULT, buf);
} /* if (nelmts) */
if (refbuf == buf)
refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */
- if(buf) {
+ if (buf) {
HDfree(buf);
buf = NULL;
}
- if(refbuf) {
+ if (refbuf) {
HDfree(refbuf);
refbuf = NULL;
}
@@ -744,27 +756,27 @@ static int copy_refs_attr(hid_t loc_in,
ref_comp_size = NULL;
}
- if(H5Aclose(attr_out) < 0)
+ if (H5Aclose(attr_out) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed");
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if(H5Tclose(ftype_id) < 0)
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Tclose(ftype_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if(H5Tclose(mtype_id) < 0)
+ if (H5Tclose(mtype_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
- if(H5Sclose(space_id) < 0)
+ if (H5Sclose(space_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
- if(H5Aclose(attr_id) < 0)
+ if (H5Aclose(attr_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed");
} /* for(u = 0; u < (unsigned)oinfo.num_attrs; u++) */
done:
- if(refbuf)
+ if (refbuf)
HDfree(refbuf);
- if(buf)
+ if (buf)
HDfree(buf);
if (ref_comp_index)
@@ -773,13 +785,15 @@ done:
if (ref_comp_size)
HDfree(ref_comp_size);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Tclose(ftype_id);
H5Tclose(mtype_id);
H5Sclose(space_id);
H5Aclose(attr_id);
H5Aclose(attr_out);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return ret_value;
}
@@ -791,29 +805,29 @@ done:
*
*-------------------------------------------------------------------------
*/
-static const char*
+static const char *
MapIdToName(hid_t refobj_id, trav_table_t *travt)
{
unsigned int u;
- const char *ret = NULL;
+ const char * ret = NULL;
/* linear search */
- for(u = 0; u < travt->nobjs; u++) {
- if(travt->objs[u].type == (h5trav_type_t)H5O_TYPE_DATASET ||
- travt->objs[u].type == (h5trav_type_t)H5O_TYPE_GROUP ||
- travt->objs[u].type == (h5trav_type_t)H5O_TYPE_NAMED_DATATYPE) {
- H5O_info_t ref_oinfo; /* Stat for the refobj id */
+ for (u = 0; u < travt->nobjs; u++) {
+ if (travt->objs[u].type == (h5trav_type_t)H5O_TYPE_DATASET ||
+ travt->objs[u].type == (h5trav_type_t)H5O_TYPE_GROUP ||
+ travt->objs[u].type == (h5trav_type_t)H5O_TYPE_NAMED_DATATYPE) {
+ H5O_info_t ref_oinfo; /* Stat for the refobj id */
/* obtain information to identify the referenced object uniquely */
- if(H5Oget_info2(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0)
+ if (H5Oget_info2(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0)
goto out;
- if(ref_oinfo.addr == travt->objs[u].objno) {
+ if (ref_oinfo.addr == travt->objs[u].objno) {
ret = travt->objs[u].name;
goto out;
}
- } /* end if */
- } /* u */
+ } /* end if */
+ } /* u */
out:
return ret;
@@ -825,13 +839,14 @@ out:
* Purpose: Update a reference value
*-------------------------------------------------------------------------
*/
-static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
- hid_t fid_out, void *ref_out, trav_table_t *travt)
+static herr_t
+update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, hid_t fid_out, void *ref_out,
+ trav_table_t *travt)
{
const char *ref_obj_name;
- hid_t space_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
hid_t ref_obj_id = H5I_INVALID_HID;
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in);
if (ref_obj_id < 0)
@@ -847,15 +862,16 @@ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
H5TOOLS_GOTO_ERROR(FAIL, "H5Rget_region failed");
}
- if(H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id) < 0)
+ if (H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Rcreate failed");
done:
- H5E_BEGIN_TRY {
- H5Sclose(space_id);
- H5Oclose(ref_obj_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Sclose(space_id);
+ H5Oclose(ref_obj_id);
+ }
+ H5E_END_TRY;
return ret_value;
}
-
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index 76adc16..159a96a 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -17,13 +17,12 @@
/* number of members in an array */
#ifndef NELMTS
-# define NELMTS(X) (sizeof(X)/sizeof(X[0]))
+#define NELMTS(X) (sizeof(X) / sizeof(X[0]))
#endif
static int verify_layout(hid_t pid, pack_info_t *obj);
static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter);
-
/*-------------------------------------------------------------------------
* Function: h5repack_verify
*
@@ -39,62 +38,62 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil
int
h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options)
{
- hid_t fidin = H5I_INVALID_HID; /* file ID for input file*/
- hid_t fidout = H5I_INVALID_HID; /* file ID for output file*/
- hid_t did = H5I_INVALID_HID; /* dataset ID */
- hid_t pid = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t sid = H5I_INVALID_HID; /* space ID */
- hid_t tid = H5I_INVALID_HID; /* type ID */
- int ok = 1; /* step results */
- unsigned int i;
- trav_table_t *travt = NULL;
- hid_t fcpl_in = H5I_INVALID_HID; /* file creation property for input file */
- hid_t fcpl_out = H5I_INVALID_HID; /* file creation property for output file */
- H5F_fspace_strategy_t in_strategy, out_strategy; /* file space handling strategy for in/output file */
- hbool_t in_persist, out_persist; /* free-space persist status for in/output file */
- hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */
- hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */
- int ret_value = 0;
+ hid_t fidin = H5I_INVALID_HID; /* file ID for input file*/
+ hid_t fidout = H5I_INVALID_HID; /* file ID for output file*/
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t pid = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t sid = H5I_INVALID_HID; /* space ID */
+ hid_t tid = H5I_INVALID_HID; /* type ID */
+ int ok = 1; /* step results */
+ unsigned int i;
+ trav_table_t * travt = NULL;
+ hid_t fcpl_in = H5I_INVALID_HID; /* file creation property for input file */
+ hid_t fcpl_out = H5I_INVALID_HID; /* file creation property for output file */
+ H5F_fspace_strategy_t in_strategy, out_strategy; /* file space handling strategy for in/output file */
+ hbool_t in_persist, out_persist; /* free-space persist status for in/output file */
+ hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */
+ hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */
+ int ret_value = 0;
/* open the output file */
- if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
+ if ((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Fopen failed on <%s>", out_fname);
- for(i = 0; i < options->op_tbl->nelems; i++) {
- char *name = options->op_tbl->objs[i].path;
- pack_info_t *obj = &options->op_tbl->objs[i];
+ for (i = 0; i < options->op_tbl->nelems; i++) {
+ char * name = options->op_tbl->objs[i].path;
+ pack_info_t *obj = &options->op_tbl->objs[i];
- /*-------------------------------------------------------------------------
- * open
- *-------------------------------------------------------------------------
- */
- if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
+ /*-------------------------------------------------------------------------
+ * open
+ *-------------------------------------------------------------------------
+ */
+ if ((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on <%s>", name);
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
- if((pid = H5Dget_create_plist(did)) < 0)
+ if ((pid = H5Dget_create_plist(did)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
- /*-------------------------------------------------------------------------
- * filter check
- *-------------------------------------------------------------------------
- */
- if(verify_filters(pid, tid, obj->nfilters, obj->filter) <= 0)
+ /*-------------------------------------------------------------------------
+ * filter check
+ *-------------------------------------------------------------------------
+ */
+ if (verify_filters(pid, tid, obj->nfilters, obj->filter) <= 0)
ok = 0;
- /*-------------------------------------------------------------------------
- * layout check
- *-------------------------------------------------------------------------
- */
- if((obj->layout != -1) && (verify_layout(pid, obj) == 0))
+ /*-------------------------------------------------------------------------
+ * layout check
+ *-------------------------------------------------------------------------
+ */
+ if ((obj->layout != -1) && (verify_layout(pid, obj) == 0))
ok = 0;
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
if (H5Pclose(pid) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Sclose(sid) < 0)
@@ -105,65 +104,65 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
}
- /*-------------------------------------------------------------------------
- * check for the "all" objects option
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * check for the "all" objects option
+ *-------------------------------------------------------------------------
+ */
- if(options->all_filter == 1 || options->all_layout == 1) {
+ if (options->all_filter == 1 || options->all_layout == 1) {
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
trav_table_init(&travt);
/* get the list of objects in the file */
- if(h5trav_gettable(fidout, travt) < 0)
+ if (h5trav_gettable(fidout, travt) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed");
- for(i = 0; i < travt->nobjs; i++) {
+ for (i = 0; i < travt->nobjs; i++) {
char *name = travt->objs[i].name;
- if(travt->objs[i].type == H5TRAV_TYPE_DATASET) {
- /*-------------------------------------------------------------------------
- * open
- *-------------------------------------------------------------------------
- */
- if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
+ if (travt->objs[i].type == H5TRAV_TYPE_DATASET) {
+ /*-------------------------------------------------------------------------
+ * open
+ *-------------------------------------------------------------------------
+ */
+ if ((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on <%s>", name);
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
- if((pid = H5Dget_create_plist(did)) < 0)
+ if ((pid = H5Dget_create_plist(did)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_type failed");
- /*-------------------------------------------------------------------------
- * filter check
- *-------------------------------------------------------------------------
- */
- if(options->all_filter == 1) {
- if(verify_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0)
+ /*-------------------------------------------------------------------------
+ * filter check
+ *-------------------------------------------------------------------------
+ */
+ if (options->all_filter == 1) {
+ if (verify_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0)
ok = 0;
}
- /*-------------------------------------------------------------------------
- * layout check
- *-------------------------------------------------------------------------
- */
- if(options->all_layout == 1) {
+ /*-------------------------------------------------------------------------
+ * layout check
+ *-------------------------------------------------------------------------
+ */
+ if (options->all_layout == 1) {
pack_info_t pack;
init_packobject(&pack);
pack.layout = options->layout_g;
- pack.chunk = options->chunk_g;
- if(verify_layout(pid, &pack) == 0)
+ pack.chunk = options->chunk_g;
+ if (verify_layout(pid, &pack) == 0)
ok = 0;
}
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
if (H5Pclose(pid) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Sclose(sid) < 0)
@@ -173,45 +172,47 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
if (H5Tclose(tid) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
} /* if */
- } /* i */
+ } /* i */
/* free table */
trav_table_free(travt);
travt = NULL;
}
- /*-------------------------------------------------------------------------
- * Verify that file space info are set as expected
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Verify that file space info are set as expected
+ *-------------------------------------------------------------------------
+ */
/* open the input file */
- if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Fopen failed on file <%s>", in_fname);
/* Get file creation property list for input file */
- if((fcpl_in = H5Fget_create_plist(fidin)) < 0)
+ if ((fcpl_in = H5Fget_create_plist(fidin)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Fget_create_plist failed to retrieve file creation property list");
/* Get file space info for input file */
- if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
+ if (H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0)
+ H5TOOLS_GOTO_ERROR((-1),
+ "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
/* Get file space page size for input file */
- if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0)
+ if (H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_page_size failed to retrieve file space page size");
/* Output file is already opened */
/* Get file creation property list for output file */
- if((fcpl_out = H5Fget_create_plist(fidout)) < 0)
+ if ((fcpl_out = H5Fget_create_plist(fidout)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Fget_create_plist failed to retrieve file creation property list");
/* Get file space info for output file */
- if(H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
+ if (H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0)
+ H5TOOLS_GOTO_ERROR((-1),
+ "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold");
/* Get file space page size for output file */
- if(H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0)
+ if (H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pget_file_space_page_size failed to retrieve file space page size");
/*
@@ -219,12 +220,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* If -S option is not set, the file space handling strategy should be
* the same as the input file's strategy.
*/
- if(options->fs_strategy) {
- if(out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy))
+ if (options->fs_strategy) {
+ if (out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy))
H5TOOLS_GOTO_ERROR((-1), "file space strategy not set as unexpected");
}
else {
- if(out_strategy != in_strategy)
+ if (out_strategy != in_strategy)
H5TOOLS_GOTO_ERROR((-1), "file space strategy not set as unexpected");
}
@@ -233,12 +234,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* If the -P option is not set, the free-space persist status should be
* the same as the input file's free-space persist status
*/
- if(options->fs_persist) {
- if(out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist))
+ if (options->fs_persist) {
+ if (out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist))
H5TOOLS_GOTO_ERROR((-1), "free-space persist status not set as unexpected");
}
else {
- if(out_persist != in_persist)
+ if (out_persist != in_persist)
H5TOOLS_GOTO_ERROR((-1), "free-space persist status not set as unexpected");
}
@@ -247,12 +248,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* If the -T option is not set, the threshold should be the same as the
* input file's threshold size.
*/
- if(options->fs_threshold) {
- if(out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold))
+ if (options->fs_threshold) {
+ if (out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold))
H5TOOLS_GOTO_ERROR((-1), "threshold not set as unexpected");
}
else {
- if(out_threshold != in_threshold)
+ if (out_threshold != in_threshold)
H5TOOLS_GOTO_ERROR((-1), "threshold not set as unexpected");
}
@@ -261,20 +262,20 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* If the -G option is not set, the file space page size should be
* the same as the input file's file space page size.
*/
- if(options->fs_pagesize) {
- if(out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize))
+ if (options->fs_pagesize) {
+ if (out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize))
H5TOOLS_GOTO_ERROR((-1), "file space page size not set as unexpected");
}
else { /* "-G" is not set */
- if(out_pagesize != in_pagesize)
+ if (out_pagesize != in_pagesize)
H5TOOLS_GOTO_ERROR((-1), "file space page size not set as unexpected");
-
}
ret_value = ok;
done:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fcpl_in);
H5Pclose(fcpl_out);
H5Pclose(pid);
@@ -285,7 +286,8 @@ done:
H5Fclose(fidout);
if (travt)
trav_table_free(travt);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return ret_value;
} /* h5repack_verify() */
@@ -305,13 +307,14 @@ done:
*-------------------------------------------------------------------------
*/
-int verify_layout(hid_t pid, pack_info_t *obj)
+int
+verify_layout(hid_t pid, pack_info_t *obj)
{
- hsize_t chsize[64]; /* chunk size in elements */
- H5D_layout_t layout; /* layout */
- int nfilters; /* number of filters */
- int rank; /* rank */
- int i; /* index */
+ hsize_t chsize[64]; /* chunk size in elements */
+ H5D_layout_t layout; /* layout */
+ int nfilters; /* number of filters */
+ int rank; /* rank */
+ int i; /* index */
/* check if we have filters in the input object */
if ((nfilters = H5Pget_nfilters(pid)) < 0)
@@ -328,8 +331,8 @@ int verify_layout(hid_t pid, pack_info_t *obj)
if (obj->layout != layout)
return 0;
- if (layout==H5D_CHUNKED) {
- if ((rank = H5Pget_chunk(pid, NELMTS(chsize), chsize/*out*/)) < 0)
+ if (layout == H5D_CHUNKED) {
+ if ((rank = H5Pget_chunk(pid, NELMTS(chsize), chsize /*out*/)) < 0)
return -1;
if (obj->chunk.rank != rank)
return 0;
@@ -353,49 +356,50 @@ int verify_layout(hid_t pid, pack_info_t *obj)
*-------------------------------------------------------------------------
*/
-int h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t fname2_fapl)
+int
+h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, hid_t fname2_fapl)
{
- hid_t fid1 = H5I_INVALID_HID; /* file ID */
- hid_t fid2 = H5I_INVALID_HID; /* file ID */
- hid_t dset1 = H5I_INVALID_HID; /* dataset ID */
- hid_t dset2 = H5I_INVALID_HID; /* dataset ID */
- hid_t gid = H5I_INVALID_HID; /* group ID */
- hid_t dcpl1 = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t dcpl2 = H5I_INVALID_HID; /* dataset creation property list ID */
- hid_t gcplid = H5I_INVALID_HID; /* group creation property list */
- unsigned crt_order_flag1; /* group creation order flag */
- unsigned crt_order_flag2; /* group creation order flag */
+ hid_t fid1 = H5I_INVALID_HID; /* file ID */
+ hid_t fid2 = H5I_INVALID_HID; /* file ID */
+ hid_t dset1 = H5I_INVALID_HID; /* dataset ID */
+ hid_t dset2 = H5I_INVALID_HID; /* dataset ID */
+ hid_t gid = H5I_INVALID_HID; /* group ID */
+ hid_t dcpl1 = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t dcpl2 = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t gcplid = H5I_INVALID_HID; /* group creation property list */
+ unsigned crt_order_flag1; /* group creation order flag */
+ unsigned crt_order_flag2; /* group creation order flag */
trav_table_t *trav = NULL;
unsigned int i;
int ret_value = 1;
- /*-------------------------------------------------------------------------
- * open the files
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * open the files
+ *-------------------------------------------------------------------------
+ */
/* Open the files */
if ((fid1 = h5tools_fopen(fname1, H5F_ACC_RDONLY, fname1_fapl, TRUE, NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR);
if ((fid2 = h5tools_fopen(fname2, H5F_ACC_RDONLY, fname2_fapl, TRUE, NULL, 0)) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR);
- /*-------------------------------------------------------------------------
- * get file table list of objects
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * get file table list of objects
+ *-------------------------------------------------------------------------
+ */
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
trav_table_init(&trav);
- if(h5trav_gettable(fid1, trav) < 0)
+ if (h5trav_gettable(fid1, trav) < 0)
H5TOOLS_GOTO_ERROR((-1), "h5trav_gettable failed");
- /*-------------------------------------------------------------------------
- * traverse the suppplied object list
- *-------------------------------------------------------------------------
- */
- for(i = 0; i < trav->nobjs; i++) {
- if(trav->objs[i].type == H5TRAV_TYPE_GROUP) {
+ /*-------------------------------------------------------------------------
+ * traverse the suppplied object list
+ *-------------------------------------------------------------------------
+ */
+ for (i = 0; i < trav->nobjs; i++) {
+ if (trav->objs[i].type == H5TRAV_TYPE_GROUP) {
if ((gid = H5Gopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Gopen2 failed on first <%s>", trav->objs[i].name);
if ((gcplid = H5Gget_create_plist(gid)) < 0)
@@ -421,40 +425,40 @@ int h5repack_cmp_pl(const char *fname1, hid_t fname1_fapl, const char *fname2, h
if (crt_order_flag1 != crt_order_flag2)
H5TOOLS_GOTO_ERROR(0, "property lists failed for <%s> are different", trav->objs[i].name);
}
- else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) {
- if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
+ else if (trav->objs[i].type == H5TRAV_TYPE_DATASET) {
+ if ((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on first <%s>", trav->objs[i].name);
- if((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0)
+ if ((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dopen2 failed on second <%s>", trav->objs[i].name);
- if((dcpl1 = H5Dget_create_plist(dset1)) < 0)
+ if ((dcpl1 = H5Dget_create_plist(dset1)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
- if((dcpl2 = H5Dget_create_plist(dset2)) < 0)
+ if ((dcpl2 = H5Dget_create_plist(dset2)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dget_create_plist failed");
- /*-------------------------------------------------------------------------
- * compare the property lists
- *-------------------------------------------------------------------------
- */
- if((ret_value = H5Pequal(dcpl1, dcpl2)) < 0)
+ /*-------------------------------------------------------------------------
+ * compare the property lists
+ *-------------------------------------------------------------------------
+ */
+ if ((ret_value = H5Pequal(dcpl1, dcpl2)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pequal failed");
- if(ret_value == 0)
+ if (ret_value == 0)
H5TOOLS_GOTO_ERROR(0, "property lists failed for <%s> are different", trav->objs[i].name);
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if(H5Pclose(dcpl1) < 0)
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Pclose(dcpl1) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if(H5Pclose(dcpl2) < 0)
+ if (H5Pclose(dcpl2) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
- if(H5Dclose(dset1) < 0)
+ if (H5Dclose(dset1) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
- if(H5Dclose(dset2) < 0)
+ if (H5Dclose(dset2) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
} /*if*/
- } /*for*/
+ } /*for*/
done:
H5E_BEGIN_TRY
@@ -467,14 +471,14 @@ done:
H5Fclose(fid2);
H5Pclose(gcplid);
H5Gclose(gid);
- if(trav)
+ if (trav)
trav_table_free(trav);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return ret_value;
}
-
/*-------------------------------------------------------------------------
* Function: verify_filters
*
@@ -489,27 +493,25 @@ done:
*-------------------------------------------------------------------------
*/
-static
-int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
+static int
+verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
{
- int nfilters_dcpl; /* number of filters in DCPL*/
- unsigned filt_flags; /* filter flags */
- H5Z_filter_t filtn; /* filter identification number */
- unsigned cd_values[20]; /* filter client data values */
- size_t cd_nelmts; /* filter client number of values */
- char f_name[256]; /* filter name */
- size_t size; /* type size */
- int i; /* index */
- unsigned j; /* index */
+ int nfilters_dcpl; /* number of filters in DCPL*/
+ unsigned filt_flags; /* filter flags */
+ H5Z_filter_t filtn; /* filter identification number */
+ unsigned cd_values[20]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+ char f_name[256]; /* filter name */
+ size_t size; /* type size */
+ int i; /* index */
+ unsigned j; /* index */
/* get information about filters */
- if((nfilters_dcpl = H5Pget_nfilters(pid)) < 0)
+ if ((nfilters_dcpl = H5Pget_nfilters(pid)) < 0)
return -1;
/* if we do not have filters and the requested filter is NONE, return 1 */
- if(!nfilters_dcpl &&
- nfilters == 1 &&
- filter[0].filtn == H5Z_FILTER_NONE)
+ if (!nfilters_dcpl && nfilters == 1 && filter[0].filtn == H5Z_FILTER_NONE)
return 1;
/* else the numbers of filters must match */
@@ -523,8 +525,8 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
for (i = 0; i < nfilters_dcpl; i++) {
cd_nelmts = NELMTS(cd_values);
- filtn = H5Pget_filter2(pid, (unsigned)i, &filt_flags, &cd_nelmts,
- cd_values, sizeof(f_name), f_name, NULL);
+ filtn = H5Pget_filter2(pid, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name,
+ NULL);
/* filter ID */
if (filtn < 0)
@@ -535,7 +537,7 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
/* compare client data values. some filters do return local values */
switch (filtn) {
case H5Z_FILTER_NONE:
- break;
+ break;
case H5Z_FILTER_SHUFFLE:
/* 1 private client value is returned by DCPL */
@@ -543,7 +545,7 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
return 0;
/* get dataset's type size */
- if((size = H5Tget_size(tid)) <= 0)
+ if ((size = H5Tget_size(tid)) <= 0)
return -1;
/* the private client value holds the dataset's type size */
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index f4fdae6..3d9e705 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "H5private.h" /* Generic Functions */
+#include "H5private.h" /* Generic Functions */
#include "h5tools.h"
#include "h5tools_utils.h"
#include "h5tools_ref.h"
@@ -24,100 +24,98 @@
/* Parameters to control statistics gathered */
/* Default threshold for small groups/datasets/attributes */
-#define DEF_SIZE_SMALL_GROUPS 10
-#define DEF_SIZE_SMALL_DSETS 10
-#define DEF_SIZE_SMALL_ATTRS 10
+#define DEF_SIZE_SMALL_GROUPS 10
+#define DEF_SIZE_SMALL_DSETS 10
+#define DEF_SIZE_SMALL_ATTRS 10
-#define SIZE_SMALL_SECTS 10
+#define SIZE_SMALL_SECTS 10
-#define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to
- accommodate for user-define filters + one
- to accomodate datasets whithout any filters */
+#define H5_NFILTERS_IMPL \
+ 8 /* Number of currently implemented filters + one to \
+ accommodate for user-define filters + one \
+ to accomodate datasets whithout any filters */
/* File space management strategies: see H5Fpublic.h for declarations */
-const char *FS_STRATEGY_NAME[] = {
- "H5F_FSPACE_STRATEGY_FSM_AGGR",
- "H5F_FSPACE_STRATEGY_PAGE",
- "H5F_FSPACE_STRATEGY_AGGR",
- "H5F_FSPACE_STRATEGY_NONE",
- "unknown",
- NULL
-};
+const char *FS_STRATEGY_NAME[] = {"H5F_FSPACE_STRATEGY_FSM_AGGR",
+ "H5F_FSPACE_STRATEGY_PAGE",
+ "H5F_FSPACE_STRATEGY_AGGR",
+ "H5F_FSPACE_STRATEGY_NONE",
+ "unknown",
+ NULL};
/* Datatype statistics for datasets */
typedef struct dtype_info_t {
- hid_t tid; /* ID of datatype */
- unsigned long count; /* Number of types found */
- unsigned long named; /* Number of types that are named */
+ hid_t tid; /* ID of datatype */
+ unsigned long count; /* Number of types found */
+ unsigned long named; /* Number of types that are named */
} dtype_info_t;
typedef struct ohdr_info_t {
- hsize_t total_size; /* Total size of object headers */
- hsize_t free_size; /* Total free space in object headers */
+ hsize_t total_size; /* Total size of object headers */
+ hsize_t free_size; /* Total free space in object headers */
} ohdr_info_t;
/* Info to pass to the iteration functions */
typedef struct iter_t {
- hid_t fid; /* File ID */
- hsize_t filesize; /* Size of the file */
- unsigned long uniq_groups; /* Number of unique groups */
- unsigned long uniq_dsets; /* Number of unique datasets */
- unsigned long uniq_dtypes; /* Number of unique named datatypes */
- unsigned long uniq_links; /* Number of unique links */
- unsigned long uniq_others; /* Number of other unique objects */
-
- unsigned long max_links; /* Maximum # of links to an object */
- hsize_t max_fanout; /* Maximum fanout from a group */
- unsigned long *num_small_groups; /* Size of small groups tracked */
- unsigned group_nbins; /* Number of bins for group counts */
- unsigned long *group_bins; /* Pointer to array of bins for group counts */
- ohdr_info_t group_ohdr_info; /* Object header information for groups */
-
- hsize_t max_attrs; /* Maximum attributes from a group */
- unsigned long *num_small_attrs; /* Size of small attributes tracked */
- unsigned attr_nbins; /* Number of bins for attribute counts */
- unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */
-
- unsigned max_dset_rank; /* Maximum rank of dataset */
- unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */
- hsize_t max_dset_dims; /* Maximum dimension size of dataset */
- unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */
- unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */
- unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */
- unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */
- dtype_info_t *dset_type_info; /* Pointer to dataset datatype information found */
- unsigned dset_dim_nbins; /* Number of bins for dataset dimensions */
- unsigned long *dset_dim_bins; /* Pointer to array of bins for dataset dimensions */
- ohdr_info_t dset_ohdr_info; /* Object header information for datasets */
- hsize_t dset_storage_size; /* Size of raw data for datasets */
- hsize_t dset_external_storage_size; /* Size of raw data for datasets with external storage */
- ohdr_info_t dtype_ohdr_info; /* Object header information for datatypes */
- hsize_t groups_btree_storage_size; /* btree size for group */
- hsize_t groups_heap_storage_size; /* heap size for group */
- hsize_t attrs_btree_storage_size; /* btree size for attributes (1.8) */
- hsize_t attrs_heap_storage_size; /* fractal heap size for attributes (1.8) */
- hsize_t SM_hdr_storage_size; /* header size for SOHM table (1.8) */
- hsize_t SM_index_storage_size; /* index (btree & list) size for SOHM table (1.8) */
- hsize_t SM_heap_storage_size; /* fractal heap size for SOHM table (1.8) */
- hsize_t super_size; /* superblock size */
- hsize_t super_ext_size; /* superblock extension size */
- hsize_t ublk_size; /* user block size (if exists) */
- H5F_fspace_strategy_t fs_strategy; /* File space management strategy */
- hbool_t fs_persist; /* Free-space persist or not */
- hsize_t fs_threshold; /* Free-space section threshold */
- hsize_t fsp_size; /* File space page size */
- hsize_t free_space; /* Amount of freespace in the file */
- hsize_t free_hdr; /* Size of free space manager metadata in the file */
- unsigned long num_small_sects[SIZE_SMALL_SECTS]; /* Size of small free-space sections */
- unsigned sect_nbins; /* Number of bins for free-space section sizes */
- unsigned long *sect_bins; /* Pointer to array of bins for free-space section sizes */
- hsize_t datasets_index_storage_size;/* meta size for chunked dataset's indexing type */
- hsize_t datasets_heap_storage_size; /* heap size for dataset with external storage */
- unsigned long nexternal; /* Number of external files for a dataset */
- int local; /* Flag to indicate iteration over the object*/
+ hid_t fid; /* File ID */
+ hsize_t filesize; /* Size of the file */
+ unsigned long uniq_groups; /* Number of unique groups */
+ unsigned long uniq_dsets; /* Number of unique datasets */
+ unsigned long uniq_dtypes; /* Number of unique named datatypes */
+ unsigned long uniq_links; /* Number of unique links */
+ unsigned long uniq_others; /* Number of other unique objects */
+
+ unsigned long max_links; /* Maximum # of links to an object */
+ hsize_t max_fanout; /* Maximum fanout from a group */
+ unsigned long *num_small_groups; /* Size of small groups tracked */
+ unsigned group_nbins; /* Number of bins for group counts */
+ unsigned long *group_bins; /* Pointer to array of bins for group counts */
+ ohdr_info_t group_ohdr_info; /* Object header information for groups */
+
+ hsize_t max_attrs; /* Maximum attributes from a group */
+ unsigned long *num_small_attrs; /* Size of small attributes tracked */
+ unsigned attr_nbins; /* Number of bins for attribute counts */
+ unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */
+
+ unsigned max_dset_rank; /* Maximum rank of dataset */
+ unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */
+ hsize_t max_dset_dims; /* Maximum dimension size of dataset */
+ unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */
+ unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */
+ unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */
+ unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */
+ dtype_info_t * dset_type_info; /* Pointer to dataset datatype information found */
+ unsigned dset_dim_nbins; /* Number of bins for dataset dimensions */
+ unsigned long *dset_dim_bins; /* Pointer to array of bins for dataset dimensions */
+ ohdr_info_t dset_ohdr_info; /* Object header information for datasets */
+ hsize_t dset_storage_size; /* Size of raw data for datasets */
+ hsize_t dset_external_storage_size; /* Size of raw data for datasets with external storage */
+ ohdr_info_t dtype_ohdr_info; /* Object header information for datatypes */
+ hsize_t groups_btree_storage_size; /* btree size for group */
+ hsize_t groups_heap_storage_size; /* heap size for group */
+ hsize_t attrs_btree_storage_size; /* btree size for attributes (1.8) */
+ hsize_t attrs_heap_storage_size; /* fractal heap size for attributes (1.8) */
+ hsize_t SM_hdr_storage_size; /* header size for SOHM table (1.8) */
+ hsize_t SM_index_storage_size; /* index (btree & list) size for SOHM table (1.8) */
+ hsize_t SM_heap_storage_size; /* fractal heap size for SOHM table (1.8) */
+ hsize_t super_size; /* superblock size */
+ hsize_t super_ext_size; /* superblock extension size */
+ hsize_t ublk_size; /* user block size (if exists) */
+ H5F_fspace_strategy_t fs_strategy; /* File space management strategy */
+ hbool_t fs_persist; /* Free-space persist or not */
+ hsize_t fs_threshold; /* Free-space section threshold */
+ hsize_t fsp_size; /* File space page size */
+ hsize_t free_space; /* Amount of freespace in the file */
+ hsize_t free_hdr; /* Size of free space manager metadata in the file */
+ unsigned long num_small_sects[SIZE_SMALL_SECTS]; /* Size of small free-space sections */
+ unsigned sect_nbins; /* Number of bins for free-space section sizes */
+ unsigned long * sect_bins; /* Pointer to array of bins for free-space section sizes */
+ hsize_t datasets_index_storage_size; /* meta size for chunked dataset's indexing type */
+ hsize_t datasets_heap_storage_size; /* heap size for dataset with external storage */
+ unsigned long nexternal; /* Number of external files for a dataset */
+ int local; /* Flag to indicate iteration over the object*/
} iter_t;
-
static const char *drivername = NULL;
#ifdef H5_HAVE_ROS3_VFD
@@ -143,27 +141,27 @@ static H5FD_hdfs_fapl_t hdfs_fa = {
};
#endif /* H5_HAVE_LIBHDFS */
-static int display_all = TRUE;
+static int display_all = TRUE;
/* Enable the printing of selected statistics */
-static int display_file = FALSE; /* display file information */
-static int display_group = FALSE; /* display groups information */
-static int display_dset = FALSE; /* display datasets information */
-static int display_dset_dtype_meta = FALSE; /* display datasets' datatype information */
-static int display_attr = FALSE; /* display attributes information */
-static int display_free_sections = FALSE; /* display free space information */
-static int display_summary = FALSE; /* display summary of file space information */
+static int display_file = FALSE; /* display file information */
+static int display_group = FALSE; /* display groups information */
+static int display_dset = FALSE; /* display datasets information */
+static int display_dset_dtype_meta = FALSE; /* display datasets' datatype information */
+static int display_attr = FALSE; /* display attributes information */
+static int display_free_sections = FALSE; /* display free space information */
+static int display_summary = FALSE; /* display summary of file space information */
-static int display_file_metadata = FALSE; /* display file space info for file's metadata */
-static int display_group_metadata = FALSE; /* display file space info for groups' metadata */
-static int display_dset_metadata = FALSE; /* display file space info for datasets' metadata */
+static int display_file_metadata = FALSE; /* display file space info for file's metadata */
+static int display_group_metadata = FALSE; /* display file space info for groups' metadata */
+static int display_dset_metadata = FALSE; /* display file space info for datasets' metadata */
-static int display_object = FALSE; /* not implemented yet */
+static int display_object = FALSE; /* not implemented yet */
/* Initialize threshold for small groups/datasets/attributes */
-static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS;
-static int sdsets_threshold = DEF_SIZE_SMALL_DSETS;
-static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS;
+static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS;
+static int sdsets_threshold = DEF_SIZE_SMALL_DSETS;
+static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS;
/* a structure for handling the order command-line parameters come in */
struct handler_t {
@@ -171,120 +169,116 @@ struct handler_t {
char **obj;
};
-static const char *s_opts ="Aa:Ddm:EFfhGgl:sSTO:Vw:H:";
+static const char *s_opts = "Aa:Ddm:EFfhGgl:sSTO:Vw:H:";
/* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */
-static struct long_options l_opts[] = {
- {"help", no_arg, 'h'},
- {"hel", no_arg, 'h'},
- {"he", no_arg, 'h'},
- {"filemetadata", no_arg, 'F'},
- {"filemetadat", no_arg, 'F'},
- {"filemetada", no_arg, 'F'},
- {"filemetad", no_arg, 'F'},
- {"filemeta", no_arg, 'F'},
- {"filemet", no_arg, 'F'},
- {"fileme", no_arg, 'F'},
- {"filem", no_arg, 'F'},
- {"file", no_arg, 'f'},
- {"fil", no_arg, 'f'},
- {"fi", no_arg, 'f'},
- {"groupmetadata", no_arg, 'G'},
- {"groupmetadat", no_arg, 'G'},
- {"groupmetada", no_arg, 'G'},
- {"groupmetad", no_arg, 'G'},
- {"groupmeta", no_arg, 'G'},
- {"groupmet", no_arg, 'G'},
- {"groupme", no_arg, 'G'},
- {"groupm", no_arg, 'G'},
- {"group", no_arg, 'g'},
- {"grou", no_arg, 'g'},
- {"gro", no_arg, 'g'},
- {"gr", no_arg, 'g'},
- { "links", require_arg, 'l' },
- { "link", require_arg, 'l' },
- { "lin", require_arg, 'l' },
- { "li", require_arg, 'l' },
- {"dsetmetadata", no_arg, 'D'},
- {"dsetmetadat", no_arg, 'D'},
- {"dsetmetada", no_arg, 'D'},
- {"dsetmetad", no_arg, 'D'},
- {"dsetmeta", no_arg, 'D'},
- {"dsetmet", no_arg, 'D'},
- {"dsetme", no_arg, 'D'},
- {"dsetm", no_arg, 'D'},
- {"dset", no_arg, 'd'},
- {"dse", no_arg, 'd'},
- {"ds", no_arg, 'd'},
- {"dims", require_arg, 'm'},
- {"dim", require_arg, 'm'},
- {"di", require_arg, 'm'},
- {"dtypemetadata", no_arg, 'T'},
- {"dtypemetadat", no_arg, 'T'},
- {"dtypemetada", no_arg, 'T'},
- {"dtypemetad", no_arg, 'T'},
- {"dtypemeta", no_arg, 'T'},
- {"dtypemet", no_arg, 'T'},
- {"dtypeme", no_arg, 'T'},
- {"dtypem", no_arg, 'T'},
- {"dtype", no_arg, 'T'},
- {"dtyp", no_arg, 'T'},
- {"dty", no_arg, 'T'},
- {"dt", no_arg, 'T'},
- { "object", require_arg, 'O' },
- { "objec", require_arg, 'O' },
- { "obje", require_arg, 'O' },
- { "obj", require_arg, 'O' },
- { "ob", require_arg, 'O' },
- { "version", no_arg, 'V' },
- { "versio", no_arg, 'V' },
- { "versi", no_arg, 'V' },
- { "vers", no_arg, 'V' },
- { "ver", no_arg, 'V' },
- { "ve", no_arg, 'V' },
- { "attribute", no_arg, 'A' },
- { "attribut", no_arg, 'A' },
- { "attribu", no_arg, 'A' },
- { "attrib", no_arg, 'A' },
- { "attri", no_arg, 'A' },
- { "attr", no_arg, 'A' },
- { "att", no_arg, 'A' },
- { "at", no_arg, 'A' },
- { "enable-error-stack", no_arg, 'E' },
- { "numattrs", require_arg, 'a' },
- { "numattr", require_arg, 'a' },
- { "numatt", require_arg, 'a' },
- { "numat", require_arg, 'a' },
- { "numa", require_arg, 'a' },
- { "num", require_arg, 'a' },
- { "nu", require_arg, 'a' },
- { "freespace", no_arg, 's' },
- { "freespac", no_arg, 's' },
- { "freespa", no_arg, 's' },
- { "freesp", no_arg, 's' },
- { "frees", no_arg, 's' },
- { "free", no_arg, 's' },
- { "fre", no_arg, 's' },
- { "fr", no_arg, 's' },
- { "summary", no_arg, 'S' },
- { "summar", no_arg, 'S' },
- { "summa", no_arg, 'S' },
- { "summ", no_arg, 'S' },
- { "sum", no_arg, 'S' },
- { "su", no_arg, 'S' },
- { "s3-cred", require_arg, 'w' },
- { "hdfs-attrs", require_arg, 'H' },
- { NULL, 0, '\0' }
-};
+static struct long_options l_opts[] = {{"help", no_arg, 'h'},
+ {"hel", no_arg, 'h'},
+ {"he", no_arg, 'h'},
+ {"filemetadata", no_arg, 'F'},
+ {"filemetadat", no_arg, 'F'},
+ {"filemetada", no_arg, 'F'},
+ {"filemetad", no_arg, 'F'},
+ {"filemeta", no_arg, 'F'},
+ {"filemet", no_arg, 'F'},
+ {"fileme", no_arg, 'F'},
+ {"filem", no_arg, 'F'},
+ {"file", no_arg, 'f'},
+ {"fil", no_arg, 'f'},
+ {"fi", no_arg, 'f'},
+ {"groupmetadata", no_arg, 'G'},
+ {"groupmetadat", no_arg, 'G'},
+ {"groupmetada", no_arg, 'G'},
+ {"groupmetad", no_arg, 'G'},
+ {"groupmeta", no_arg, 'G'},
+ {"groupmet", no_arg, 'G'},
+ {"groupme", no_arg, 'G'},
+ {"groupm", no_arg, 'G'},
+ {"group", no_arg, 'g'},
+ {"grou", no_arg, 'g'},
+ {"gro", no_arg, 'g'},
+ {"gr", no_arg, 'g'},
+ {"links", require_arg, 'l'},
+ {"link", require_arg, 'l'},
+ {"lin", require_arg, 'l'},
+ {"li", require_arg, 'l'},
+ {"dsetmetadata", no_arg, 'D'},
+ {"dsetmetadat", no_arg, 'D'},
+ {"dsetmetada", no_arg, 'D'},
+ {"dsetmetad", no_arg, 'D'},
+ {"dsetmeta", no_arg, 'D'},
+ {"dsetmet", no_arg, 'D'},
+ {"dsetme", no_arg, 'D'},
+ {"dsetm", no_arg, 'D'},
+ {"dset", no_arg, 'd'},
+ {"dse", no_arg, 'd'},
+ {"ds", no_arg, 'd'},
+ {"dims", require_arg, 'm'},
+ {"dim", require_arg, 'm'},
+ {"di", require_arg, 'm'},
+ {"dtypemetadata", no_arg, 'T'},
+ {"dtypemetadat", no_arg, 'T'},
+ {"dtypemetada", no_arg, 'T'},
+ {"dtypemetad", no_arg, 'T'},
+ {"dtypemeta", no_arg, 'T'},
+ {"dtypemet", no_arg, 'T'},
+ {"dtypeme", no_arg, 'T'},
+ {"dtypem", no_arg, 'T'},
+ {"dtype", no_arg, 'T'},
+ {"dtyp", no_arg, 'T'},
+ {"dty", no_arg, 'T'},
+ {"dt", no_arg, 'T'},
+ {"object", require_arg, 'O'},
+ {"objec", require_arg, 'O'},
+ {"obje", require_arg, 'O'},
+ {"obj", require_arg, 'O'},
+ {"ob", require_arg, 'O'},
+ {"version", no_arg, 'V'},
+ {"versio", no_arg, 'V'},
+ {"versi", no_arg, 'V'},
+ {"vers", no_arg, 'V'},
+ {"ver", no_arg, 'V'},
+ {"ve", no_arg, 'V'},
+ {"attribute", no_arg, 'A'},
+ {"attribut", no_arg, 'A'},
+ {"attribu", no_arg, 'A'},
+ {"attrib", no_arg, 'A'},
+ {"attri", no_arg, 'A'},
+ {"attr", no_arg, 'A'},
+ {"att", no_arg, 'A'},
+ {"at", no_arg, 'A'},
+ {"enable-error-stack", no_arg, 'E'},
+ {"numattrs", require_arg, 'a'},
+ {"numattr", require_arg, 'a'},
+ {"numatt", require_arg, 'a'},
+ {"numat", require_arg, 'a'},
+ {"numa", require_arg, 'a'},
+ {"num", require_arg, 'a'},
+ {"nu", require_arg, 'a'},
+ {"freespace", no_arg, 's'},
+ {"freespac", no_arg, 's'},
+ {"freespa", no_arg, 's'},
+ {"freesp", no_arg, 's'},
+ {"frees", no_arg, 's'},
+ {"free", no_arg, 's'},
+ {"fre", no_arg, 's'},
+ {"fr", no_arg, 's'},
+ {"summary", no_arg, 'S'},
+ {"summar", no_arg, 'S'},
+ {"summa", no_arg, 'S'},
+ {"summ", no_arg, 'S'},
+ {"sum", no_arg, 'S'},
+ {"su", no_arg, 'S'},
+ {"s3-cred", require_arg, 'w'},
+ {"hdfs-attrs", require_arg, 'H'},
+ {NULL, 0, '\0'}};
static void
leave(int ret)
{
- h5tools_close();
- HDexit(ret);
+ h5tools_close();
+ HDexit(ret);
}
-
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -294,47 +288,49 @@ leave(int ret)
*
*-------------------------------------------------------------------------
*/
-static void usage(const char *prog)
+static void
+usage(const char *prog)
{
- HDfflush(stdout);
- HDfprintf(stdout, "Usage: %s [OPTIONS] file\n", prog);
- HDfprintf(stdout, "\n");
- HDfprintf(stdout, " OPTIONS\n");
- HDfprintf(stdout, " -h, --help Print a usage message and exit\n");
- HDfprintf(stdout, " -V, --version Print version number and exit\n");
- HDfprintf(stdout, " -f, --file Print file information\n");
- HDfprintf(stdout, " -F, --filemetadata Print file space information for file's metadata\n");
- HDfprintf(stdout, " -g, --group Print group information\n");
- HDfprintf(stdout, " -l N, --links=N Set the threshold for the # of links when printing\n");
- HDfprintf(stdout, " information for small groups. N is an integer greater\n");
- HDfprintf(stdout, " than 0. The default threshold is 10.\n");
- HDfprintf(stdout, " -G, --groupmetadata Print file space information for groups' metadata\n");
- HDfprintf(stdout, " -d, --dset Print dataset information\n");
- HDfprintf(stdout, " -m N, --dims=N Set the threshold for the dimension sizes when printing\n");
- HDfprintf(stdout, " information for small datasets. N is an integer greater\n");
- HDfprintf(stdout, " than 0. The default threshold is 10.\n");
- HDfprintf(stdout, " -D, --dsetmetadata Print file space information for datasets' metadata\n");
- HDfprintf(stdout, " -T, --dtypemetadata Print datasets' datatype information\n");
- HDfprintf(stdout, " -A, --attribute Print attribute information\n");
- HDfprintf(stdout, " -a N, --numattrs=N Set the threshold for the # of attributes when printing\n");
- HDfprintf(stdout, " information for small # of attributes. N is an integer greater\n");
- HDfprintf(stdout, " than 0. The default threshold is 10.\n");
- HDfprintf(stdout, " -s, --freespace Print free space information\n");
- HDfprintf(stdout, " -S, --summary Print summary of file space information\n");
- HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n");
- HDfprintf(stdout, " --s3-cred=<cred> Access file on S3, using provided credential\n");
- HDfprintf(stdout, " <cred> :: (region,id,key)\n");
- HDfprintf(stdout, " If <cred> == \"(,,)\", no authentication is used.\n");
- HDfprintf(stdout, " --hdfs-attrs=<attrs> Access a file on HDFS with given configuration\n");
- HDfprintf(stdout, " attributes.\n");
- HDfprintf(stdout, " <attrs> :: (<namenode name>,<namenode port>,\n");
- HDfprintf(stdout, " <kerberos cache path>,<username>,\n");
- HDfprintf(stdout, " <buffer size>)\n");
- HDfprintf(stdout, " If an attribute is empty, a default value will be\n");
- HDfprintf(stdout, " used.\n");
+ HDfflush(stdout);
+ HDfprintf(stdout, "Usage: %s [OPTIONS] file\n", prog);
+ HDfprintf(stdout, "\n");
+ HDfprintf(stdout, " OPTIONS\n");
+ HDfprintf(stdout, " -h, --help Print a usage message and exit\n");
+ HDfprintf(stdout, " -V, --version Print version number and exit\n");
+ HDfprintf(stdout, " -f, --file Print file information\n");
+ HDfprintf(stdout, " -F, --filemetadata Print file space information for file's metadata\n");
+ HDfprintf(stdout, " -g, --group Print group information\n");
+ HDfprintf(stdout, " -l N, --links=N Set the threshold for the # of links when printing\n");
+ HDfprintf(stdout, " information for small groups. N is an integer greater\n");
+ HDfprintf(stdout, " than 0. The default threshold is 10.\n");
+ HDfprintf(stdout, " -G, --groupmetadata Print file space information for groups' metadata\n");
+ HDfprintf(stdout, " -d, --dset Print dataset information\n");
+ HDfprintf(stdout, " -m N, --dims=N Set the threshold for the dimension sizes when printing\n");
+ HDfprintf(stdout,
+ " information for small datasets. N is an integer greater\n");
+ HDfprintf(stdout, " than 0. The default threshold is 10.\n");
+ HDfprintf(stdout, " -D, --dsetmetadata Print file space information for datasets' metadata\n");
+ HDfprintf(stdout, " -T, --dtypemetadata Print datasets' datatype information\n");
+ HDfprintf(stdout, " -A, --attribute Print attribute information\n");
+ HDfprintf(stdout, " -a N, --numattrs=N Set the threshold for the # of attributes when printing\n");
+ HDfprintf(stdout,
+ " information for small # of attributes. N is an integer greater\n");
+ HDfprintf(stdout, " than 0. The default threshold is 10.\n");
+ HDfprintf(stdout, " -s, --freespace Print free space information\n");
+ HDfprintf(stdout, " -S, --summary Print summary of file space information\n");
+ HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n");
+ HDfprintf(stdout, " --s3-cred=<cred> Access file on S3, using provided credential\n");
+ HDfprintf(stdout, " <cred> :: (region,id,key)\n");
+ HDfprintf(stdout, " If <cred> == \"(,,)\", no authentication is used.\n");
+ HDfprintf(stdout, " --hdfs-attrs=<attrs> Access a file on HDFS with given configuration\n");
+ HDfprintf(stdout, " attributes.\n");
+ HDfprintf(stdout, " <attrs> :: (<namenode name>,<namenode port>,\n");
+ HDfprintf(stdout, " <kerberos cache path>,<username>,\n");
+ HDfprintf(stdout, " <buffer size>)\n");
+ HDfprintf(stdout, " If an attribute is empty, a default value will be\n");
+ HDfprintf(stdout, " used.\n");
}
-
/*-------------------------------------------------------------------------
* Function: ceil_log10
*
@@ -351,9 +347,9 @@ H5_ATTR_CONST static unsigned
ceil_log10(unsigned long x)
{
unsigned long pow10 = 1;
- unsigned ret = 0;
+ unsigned ret = 0;
- while(x >= pow10) {
+ while (x >= pow10) {
pow10 *= 10;
ret++;
} /* end while */
@@ -361,7 +357,6 @@ ceil_log10(unsigned long x)
return ret;
} /* ceil_log10() */
-
/*-------------------------------------------------------------------------
* Function: attribute_stats
*
@@ -379,39 +374,38 @@ ceil_log10(unsigned long x)
static herr_t
attribute_stats(iter_t *iter, const H5O_info_t *oi)
{
- unsigned bin; /* "bin" the number of objects falls in */
+ unsigned bin; /* "bin" the number of objects falls in */
/* Update dataset & attribute metadata info */
iter->attrs_btree_storage_size += oi->meta_size.attr.index_size;
iter->attrs_heap_storage_size += oi->meta_size.attr.heap_size;
/* Update small # of attribute count & limits */
- if(oi->num_attrs <= (hsize_t)sattrs_threshold)
+ if (oi->num_attrs <= (hsize_t)sattrs_threshold)
(iter->num_small_attrs[(size_t)oi->num_attrs])++;
- if(oi->num_attrs > iter->max_attrs)
+ if (oi->num_attrs > iter->max_attrs)
iter->max_attrs = oi->num_attrs;
/* Add attribute count to proper bin */
bin = ceil_log10((unsigned long)oi->num_attrs);
- if((bin + 1) > iter->attr_nbins) {
+ if ((bin + 1) > iter->attr_nbins) {
iter->attr_bins = (unsigned long *)HDrealloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long));
HDassert(iter->attr_bins);
/* Initialize counts for intermediate bins */
- while(iter->attr_nbins < bin)
+ while (iter->attr_nbins < bin)
iter->attr_bins[iter->attr_nbins++] = 0;
iter->attr_nbins++;
/* Initialize count for new bin */
iter->attr_bins[bin] = 1;
- } /* end if */
- else
- (iter->attr_bins[bin])++;
+ } /* end if */
+ else
+ (iter->attr_bins[bin])++;
- return 0;
+ return 0;
} /* end attribute_stats() */
-
/*-------------------------------------------------------------------------
* Function: group_stats
*
@@ -440,9 +434,9 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi)
static herr_t
group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
{
- H5G_info_t ginfo; /* Group information */
- unsigned bin; /* "bin" the number of objects falls in */
- herr_t ret_value = SUCCEED;
+ H5G_info_t ginfo; /* Group information */
+ unsigned bin; /* "bin" the number of objects falls in */
+ herr_t ret_value = SUCCEED;
/* Gather statistics about this type of object */
iter->uniq_groups++;
@@ -452,26 +446,27 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->group_ohdr_info.free_size += oi->hdr.space.free;
/* Get group information */
- if((ret_value = H5Gget_info_by_name(iter->fid, name, &ginfo, H5P_DEFAULT)) < 0)
+ if ((ret_value = H5Gget_info_by_name(iter->fid, name, &ginfo, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Gget_info_by_name() failed");
/* Update link stats */
/* Collect statistics for small groups */
- if(ginfo.nlinks < (hsize_t)sgroups_threshold)
+ if (ginfo.nlinks < (hsize_t)sgroups_threshold)
(iter->num_small_groups[(size_t)ginfo.nlinks])++;
/* Determine maximum link count */
- if(ginfo.nlinks > iter->max_fanout)
+ if (ginfo.nlinks > iter->max_fanout)
iter->max_fanout = ginfo.nlinks;
/* Add group count to proper bin */
bin = ceil_log10((unsigned long)ginfo.nlinks);
- if((bin + 1) > iter->group_nbins) {
+ if ((bin + 1) > iter->group_nbins) {
/* Allocate more storage for info about dataset's datatype */
- if((iter->group_bins = (unsigned long *)HDrealloc(iter->group_bins, (bin + 1) * sizeof(unsigned long))) == NULL)
+ if ((iter->group_bins =
+ (unsigned long *)HDrealloc(iter->group_bins, (bin + 1) * sizeof(unsigned long))) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed");
/* Initialize counts for intermediate bins */
- while(iter->group_nbins < bin)
+ while (iter->group_nbins < bin)
iter->group_bins[iter->group_nbins++] = 0;
iter->group_nbins++;
@@ -486,14 +481,13 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->groups_heap_storage_size += oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if ((ret_value = attribute_stats(iter, oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats failed");
done:
return ret_value;
} /* end group_stats() */
-
/*-------------------------------------------------------------------------
* Function: dataset_stats
*
@@ -510,22 +504,22 @@ done:
static herr_t
dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
{
- unsigned bin; /* "bin" the number of objects falls in */
- hid_t did; /* Dataset ID */
- hid_t sid; /* Dataspace ID */
- hid_t tid; /* Datatype ID */
- hid_t dcpl; /* Dataset creation property list ID */
- hsize_t dims[H5S_MAX_RANK]; /* Dimensions of dataset */
- H5D_layout_t lout; /* Layout of dataset */
- unsigned type_found; /* Whether the dataset's datatype was */
- /* already found */
- int ndims; /* Number of dimensions of dataset */
- hsize_t storage; /* Size of dataset storage */
- unsigned u; /* Local index variable */
- int num_ext; /* Number of external files for a dataset */
- int nfltr; /* Number of filters for a dataset */
- H5Z_filter_t fltr; /* Filter identifier */
- herr_t ret_value = SUCCEED;
+ unsigned bin; /* "bin" the number of objects falls in */
+ hid_t did; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hid_t dcpl; /* Dataset creation property list ID */
+ hsize_t dims[H5S_MAX_RANK]; /* Dimensions of dataset */
+ H5D_layout_t lout; /* Layout of dataset */
+ unsigned type_found; /* Whether the dataset's datatype was */
+ /* already found */
+ int ndims; /* Number of dimensions of dataset */
+ hsize_t storage; /* Size of dataset storage */
+ unsigned u; /* Local index variable */
+ int num_ext; /* Number of external files for a dataset */
+ int nfltr; /* Number of filters for a dataset */
+ H5Z_filter_t fltr; /* Filter identifier */
+ herr_t ret_value = SUCCEED;
/* Gather statistics about this type of object */
iter->uniq_dsets++;
@@ -534,7 +528,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->dset_ohdr_info.total_size += oi->hdr.space.total;
iter->dset_ohdr_info.free_size += oi->hdr.space.free;
- if((did = H5Dopen2(iter->fid, name, H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(iter->fid, name, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen() failed");
/* Update dataset metadata info */
@@ -542,7 +536,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->datasets_heap_storage_size += oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if ((ret_value = attribute_stats(iter, oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed");
/* Get storage info */
@@ -550,26 +544,26 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
storage = H5Dget_storage_size(did);
/* Gather layout statistics */
- if((dcpl = H5Dget_create_plist(did)) < 0)
+ if ((dcpl = H5Dget_create_plist(did)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_create_plist() failed");
- if((lout = H5Pget_layout(dcpl)) < 0)
+ if ((lout = H5Pget_layout(dcpl)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_layout() failed");
/* Object header's total size for H5D_COMPACT layout includes raw data size */
/* "storage" also includes H5D_COMPACT raw data size */
- if(lout == H5D_COMPACT)
+ if (lout == H5D_COMPACT)
iter->dset_ohdr_info.total_size -= storage;
/* Track the layout type for dataset */
(iter->dset_layouts[lout])++;
/* Get the number of external files for the dataset */
- if((num_ext = H5Pget_external_count(dcpl)) < 0)
+ if ((num_ext = H5Pget_external_count(dcpl)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_external_count() failed");
/* Accumulate raw data size accordingly */
- if(num_ext) {
+ if (num_ext) {
iter->nexternal += (unsigned long)num_ext;
iter->dset_external_storage_size += (unsigned long)storage;
}
@@ -577,37 +571,38 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->dset_storage_size += storage;
/* Gather dataspace statistics */
- if((sid = H5Dget_space(did)) < 0)
+ if ((sid = H5Dget_space(did)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_space() failed");
- if((ndims = H5Sget_simple_extent_dims(sid, dims, NULL)) < 0)
+ if ((ndims = H5Sget_simple_extent_dims(sid, dims, NULL)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims() failed");
/* Check for larger rank of dataset */
- if((unsigned)ndims > iter->max_dset_rank)
+ if ((unsigned)ndims > iter->max_dset_rank)
iter->max_dset_rank = (unsigned)ndims;
/* Track the number of datasets with each rank */
(iter->dset_rank_count[ndims])++;
/* Only gather dim size statistics on 1-D datasets */
- if(ndims == 1) {
+ if (ndims == 1) {
/* Determine maximum dimension size */
- if(dims[0] > iter->max_dset_dims)
+ if (dims[0] > iter->max_dset_dims)
iter->max_dset_dims = dims[0];
/* Collect statistics for small datasets */
- if(dims[0] < (hsize_t)sdsets_threshold)
+ if (dims[0] < (hsize_t)sdsets_threshold)
(iter->small_dset_dims[(size_t)dims[0]])++;
/* Add dim count to proper bin */
bin = ceil_log10((unsigned long)dims[0]);
- if((bin + 1) > iter->dset_dim_nbins) {
+ if ((bin + 1) > iter->dset_dim_nbins) {
/* Allocate more storage for info about dataset's datatype */
- if((iter->dset_dim_bins = (unsigned long *)HDrealloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long))) == NULL)
+ if ((iter->dset_dim_bins = (unsigned long *)HDrealloc(iter->dset_dim_bins,
+ (bin + 1) * sizeof(unsigned long))) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed");
/* Initialize counts for intermediate bins */
- while(iter->dset_dim_nbins < bin)
+ while (iter->dset_dim_nbins < bin)
iter->dset_dim_bins[iter->dset_dim_nbins++] = 0;
iter->dset_dim_nbins++;
@@ -618,22 +613,22 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
(iter->dset_dim_bins[bin])++;
} /* end if */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Sclose() failed");
/* Gather datatype statistics */
- if((tid = H5Dget_type(did)) < 0)
+ if ((tid = H5Dget_type(did)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_type() failed");
type_found = FALSE;
- for(u = 0; u < iter->dset_ntypes; u++)
- if(H5Tequal(iter->dset_type_info[u].tid, tid) > 0) {
+ for (u = 0; u < iter->dset_ntypes; u++)
+ if (H5Tequal(iter->dset_type_info[u].tid, tid) > 0) {
type_found = TRUE;
break;
} /* end for */
- if(type_found)
- (iter->dset_type_info[u].count)++;
+ if (type_found)
+ (iter->dset_type_info[u].count)++;
else {
unsigned curr_ntype = (unsigned)iter->dset_ntypes;
@@ -641,11 +636,12 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
iter->dset_ntypes++;
/* Allocate more storage for info about dataset's datatype */
- if((iter->dset_type_info = (dtype_info_t *)HDrealloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t))) == NULL)
+ if ((iter->dset_type_info = (dtype_info_t *)HDrealloc(
+ iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t))) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed");
/* Initialize information about datatype */
- if((iter->dset_type_info[curr_ntype].tid = H5Tcopy(tid)) < 0)
+ if ((iter->dset_type_info[curr_ntype].tid = H5Tcopy(tid)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Tcopy() failed");
iter->dset_type_info[curr_ntype].count = 1;
iter->dset_type_info[curr_ntype].named = 0;
@@ -655,37 +651,36 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
} /* end else */
/* Check if the datatype is a named datatype */
- if(H5Tcommitted(tid) > 0)
+ if (H5Tcommitted(tid) > 0)
(iter->dset_type_info[u].named)++;
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose() failed");
/* Track different filters */
- if((nfltr = H5Pget_nfilters(dcpl)) >= 0) {
- if(nfltr == 0)
- iter->dset_comptype[0]++;
- for(u = 0; u < (unsigned)nfltr; u++) {
+ if ((nfltr = H5Pget_nfilters(dcpl)) >= 0) {
+ if (nfltr == 0)
+ iter->dset_comptype[0]++;
+ for (u = 0; u < (unsigned)nfltr; u++) {
fltr = H5Pget_filter2(dcpl, u, 0, 0, 0, 0, 0, NULL);
- if(fltr >= 0) {
- if(fltr < (H5_NFILTERS_IMPL - 1))
+ if (fltr >= 0) {
+ if (fltr < (H5_NFILTERS_IMPL - 1))
iter->dset_comptype[fltr]++;
else
iter->dset_comptype[H5_NFILTERS_IMPL - 1]++; /*other filters*/
- } /* end if */
- } /* end for */
- } /* endif nfltr */
+ } /* end if */
+ } /* end for */
+ } /* endif nfltr */
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose() failed");
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose() failed");
done:
- return ret_value;
-} /* end dataset_stats() */
-
+ return ret_value;
+} /* end dataset_stats() */
/*-------------------------------------------------------------------------
* Function: datatype_stats
@@ -712,12 +707,11 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi)
iter->dtype_ohdr_info.free_size += oi->hdr.space.free;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
+ if ((ret_value = attribute_stats(iter, oi)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed");
done:
- return ret_value;
-} /* end datatype_stats() */
-
+ return ret_value;
+} /* end datatype_stats() */
/*-------------------------------------------------------------------------
* Function: obj_stats
@@ -733,31 +727,30 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
- void *_iter)
+obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited, void *_iter)
{
- iter_t *iter = (iter_t *)_iter;
- herr_t ret_value = SUCCEED;
+ iter_t *iter = (iter_t *)_iter;
+ herr_t ret_value = SUCCEED;
/* If the object has already been seen then just return */
- if(NULL == already_visited) {
+ if (NULL == already_visited) {
/* Gather some general statistics about the object */
- if(oi->rc > iter->max_links)
+ if (oi->rc > iter->max_links)
iter->max_links = oi->rc;
- switch(oi->type) {
+ switch (oi->type) {
case H5O_TYPE_GROUP:
- if(group_stats(iter, path, oi) < 0)
+ if (group_stats(iter, path, oi) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "group_stats failed");
break;
case H5O_TYPE_DATASET:
- if(dataset_stats(iter, path, oi) < 0)
+ if (dataset_stats(iter, path, oi) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "dataset_stats failed");
break;
case H5O_TYPE_NAMED_DATATYPE:
- if(datatype_stats(iter, oi) < 0)
+ if (datatype_stats(iter, oi) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "datatype_stats failed");
break;
@@ -768,13 +761,12 @@ obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
iter->uniq_others++;
break;
} /* end switch */
- } /* end if */
+ } /* end if */
done:
return ret_value;
} /* end obj_stats() */
-
/*-------------------------------------------------------------------------
* Function: lnk_stats
*
@@ -793,7 +785,7 @@ lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info_t *li, void *_iter)
{
iter_t *iter = (iter_t *)_iter;
- switch(li->type) {
+ switch (li->type) {
case H5L_TYPE_SOFT:
case H5L_TYPE_EXTERNAL:
/* Gather statistics about links and UD links */
@@ -827,35 +819,35 @@ lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info_t *li, void *_iter)
static herr_t
freespace_stats(hid_t fid, iter_t *iter)
{
- H5F_sect_info_t *sect_info = NULL; /* Free space sections */
- ssize_t nsects; /* Number of free space sections */
- size_t u; /* Local index variable */
+ H5F_sect_info_t *sect_info = NULL; /* Free space sections */
+ ssize_t nsects; /* Number of free space sections */
+ size_t u; /* Local index variable */
/* Query section information */
- if((nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, 0, NULL)) < 0)
- return(FAIL);
- else if(nsects) {
- if(NULL == (sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t))))
- return(FAIL);
+ if ((nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, 0, NULL)) < 0)
+ return (FAIL);
+ else if (nsects) {
+ if (NULL == (sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t))))
+ return (FAIL);
nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info);
HDassert(nsects);
} /* end else-if */
- for(u = 0; u < (size_t)nsects; u++) {
- unsigned bin; /* "bin" the number of objects falls in */
+ for (u = 0; u < (size_t)nsects; u++) {
+ unsigned bin; /* "bin" the number of objects falls in */
- if(sect_info[u].size < SIZE_SMALL_SECTS)
+ if (sect_info[u].size < SIZE_SMALL_SECTS)
(iter->num_small_sects[(size_t)sect_info[u].size])++;
/* Add section size to proper bin */
bin = ceil_log10((unsigned long)sect_info[u].size);
- if(bin >= iter->sect_nbins) {
+ if (bin >= iter->sect_nbins) {
/* Allocate more storage for section info */
iter->sect_bins = (unsigned long *)HDrealloc(iter->sect_bins, (bin + 1) * sizeof(unsigned long));
HDassert(iter->sect_bins);
/* Initialize counts for intermediate bins */
- while(iter->sect_nbins < bin)
+ while (iter->sect_nbins < bin)
iter->sect_bins[iter->sect_nbins++] = 0;
iter->sect_nbins++;
@@ -866,13 +858,12 @@ freespace_stats(hid_t fid, iter_t *iter)
(iter->sect_bins[bin])++;
} /* end for */
- if(sect_info)
+ if (sect_info)
HDfree(sect_info);
return 0;
} /* end freespace_stats() */
-
/*-------------------------------------------------------------------------
* Function: hand_free
*
@@ -887,11 +878,11 @@ freespace_stats(hid_t fid, iter_t *iter)
static void
hand_free(struct handler_t *hand)
{
- if(hand) {
+ if (hand) {
unsigned u;
- for(u = 0; u < hand->obj_count; u++)
- if(hand->obj[u]) {
+ for (u = 0; u < hand->obj_count; u++)
+ if (hand->obj[u]) {
HDfree(hand->obj[u]);
hand->obj[u] = NULL;
} /* end if */
@@ -901,7 +892,6 @@ hand_free(struct handler_t *hand)
} /* end if */
} /* end hand_free() */
-
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -919,13 +909,13 @@ hand_free(struct handler_t *hand)
static int
parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
{
- int opt;
- unsigned u;
- struct handler_t *hand = NULL;
+ int opt;
+ unsigned u;
+ struct handler_t *hand = NULL;
/* parse command line options */
- while((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch((char)opt) {
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
case 'h':
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_SUCCESS);
@@ -943,29 +933,29 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
break;
case 'F':
- display_all = FALSE;
+ display_all = FALSE;
display_file_metadata = TRUE;
break;
case 'f':
- display_all = FALSE;
+ display_all = FALSE;
display_file = TRUE;
break;
case 'G':
- display_all = FALSE;
+ display_all = FALSE;
display_group_metadata = TRUE;
break;
case 'g':
- display_all = FALSE;
+ display_all = FALSE;
display_group = TRUE;
break;
case 'l':
- if(opt_arg) {
+ if (opt_arg) {
sgroups_threshold = HDatoi(opt_arg);
- if(sgroups_threshold < 1) {
+ if (sgroups_threshold < 1) {
error_msg("Invalid threshold for small groups\n");
goto error;
}
@@ -976,19 +966,19 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
break;
case 'D':
- display_all = FALSE;
+ display_all = FALSE;
display_dset_metadata = TRUE;
break;
case 'd':
- display_all = FALSE;
+ display_all = FALSE;
display_dset = TRUE;
break;
case 'm':
- if(opt_arg) {
+ if (opt_arg) {
sdsets_threshold = HDatoi(opt_arg);
- if(sdsets_threshold < 1) {
+ if (sdsets_threshold < 1) {
error_msg("Invalid threshold for small datasets\n");
goto error;
}
@@ -999,19 +989,19 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
break;
case 'T':
- display_all = FALSE;
+ display_all = FALSE;
display_dset_dtype_meta = TRUE;
break;
case 'A':
- display_all = FALSE;
+ display_all = FALSE;
display_attr = TRUE;
break;
case 'a':
- if(opt_arg) {
+ if (opt_arg) {
sattrs_threshold = HDatoi(opt_arg);
- if(sattrs_threshold < 1) {
+ if (sattrs_threshold < 1) {
error_msg("Invalid threshold for small # of attributes\n");
goto error;
}
@@ -1022,35 +1012,35 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
break;
case 's':
- display_all = FALSE;
+ display_all = FALSE;
display_free_sections = TRUE;
break;
case 'S':
- display_all = FALSE;
+ display_all = FALSE;
display_summary = TRUE;
break;
case 'O':
- display_all = FALSE;
+ display_all = FALSE;
display_object = TRUE;
/* Allocate space to hold the command line info */
- if(NULL == (hand = (struct handler_t *)HDcalloc((size_t)1, sizeof(struct handler_t)))) {
+ if (NULL == (hand = (struct handler_t *)HDcalloc((size_t)1, sizeof(struct handler_t)))) {
error_msg("unable to allocate memory for object struct\n");
goto error;
} /* end if */
/* Allocate space to hold the object strings */
hand->obj_count = (size_t)argc;
- if(NULL == (hand->obj = (char **)HDcalloc((size_t)argc, sizeof(char *)))) {
+ if (NULL == (hand->obj = (char **)HDcalloc((size_t)argc, sizeof(char *)))) {
error_msg("unable to allocate memory for object array\n");
goto error;
} /* end if */
/* Store object names */
- for(u = 0; u < hand->obj_count; u++)
- if(NULL == (hand->obj[u] = HDstrdup(opt_arg))) {
+ for (u = 0; u < hand->obj_count; u++)
+ if (NULL == (hand->obj[u] = HDstrdup(opt_arg))) {
error_msg("unable to allocate memory for object name\n");
goto error;
} /* end if */
@@ -1088,10 +1078,10 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
usage(h5tools_getprogname());
goto error;
} /* end switch */
- } /* end while */
+ } /* end while */
/* check for file name to be processed */
- if(argc <= opt_ind) {
+ if (argc <= opt_ind) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
goto error;
@@ -1110,7 +1100,6 @@ error:
return -1;
}
-
/*-------------------------------------------------------------------------
* Function: iter_free
*
@@ -1127,55 +1116,54 @@ iter_free(iter_t *iter)
{
/* Clear array of bins for group counts */
- if(iter->group_bins) {
+ if (iter->group_bins) {
HDfree(iter->group_bins);
iter->group_bins = NULL;
} /* end if */
/* Clear array for tracking small groups */
- if(iter->num_small_groups) {
+ if (iter->num_small_groups) {
HDfree(iter->num_small_groups);
iter->num_small_groups = NULL;
} /* end if */
/* Clear array of bins for attribute counts */
- if(iter->attr_bins) {
+ if (iter->attr_bins) {
HDfree(iter->attr_bins);
iter->attr_bins = NULL;
} /* end if */
/* Clear array for tracking small attributes */
- if(iter->num_small_attrs) {
+ if (iter->num_small_attrs) {
HDfree(iter->num_small_attrs);
- iter->num_small_attrs= NULL;
+ iter->num_small_attrs = NULL;
} /* end if */
/* Clear dataset datatype information found */
- if(iter->dset_type_info) {
+ if (iter->dset_type_info) {
HDfree(iter->dset_type_info);
iter->dset_type_info = NULL;
} /* end if */
/* Clear array of bins for dataset dimensions */
- if(iter->dset_dim_bins) {
+ if (iter->dset_dim_bins) {
HDfree(iter->dset_dim_bins);
iter->dset_dim_bins = NULL;
} /* end if */
/* Clear array of tracking 1-D small datasets */
- if(iter->small_dset_dims) {
+ if (iter->small_dset_dims) {
HDfree(iter->small_dset_dims);
iter->small_dset_dims = NULL;
} /* end if */
/* Clear array of bins for free-space section sizes */
- if(iter->sect_bins) {
+ if (iter->sect_bins) {
HDfree(iter->sect_bins);
iter->sect_bins = NULL;
} /* end if */
} /* end iter_free() */
-
/*-------------------------------------------------------------------------
* Function: print_file_info
*
@@ -1207,7 +1195,6 @@ print_file_info(const iter_t *iter)
return 0;
} /* print_file_info() */
-
/*-------------------------------------------------------------------------
* Function: print_file_metadata
*
@@ -1232,11 +1219,11 @@ print_file_metadata(const iter_t *iter)
HDfprintf(stdout, "\tObject headers: (total/unused)\n");
HDfprintf(stdout, "\t\tGroups: %Hu/%Hu\n", iter->group_ohdr_info.total_size,
- iter->group_ohdr_info.free_size);
- HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n",
- iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size);
+ iter->group_ohdr_info.free_size);
+ HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n", iter->dset_ohdr_info.total_size,
+ iter->dset_ohdr_info.free_size);
HDfprintf(stdout, "\t\tDatatypes: %Hu/%Hu\n", iter->dtype_ohdr_info.total_size,
- iter->dtype_ohdr_info.free_size);
+ iter->dtype_ohdr_info.free_size);
HDfprintf(stdout, "\tGroups:\n");
HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->groups_btree_storage_size);
@@ -1264,7 +1251,6 @@ print_file_metadata(const iter_t *iter)
return 0;
} /* print_file_metadata() */
-
/*-------------------------------------------------------------------------
* Function: print_group_info
*
@@ -1287,32 +1273,32 @@ print_file_metadata(const iter_t *iter)
static herr_t
print_group_info(const iter_t *iter)
{
- unsigned long power; /* Temporary "power" for bins */
- unsigned long total; /* Total count for various statistics */
- unsigned u; /* Local index variable */
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
- HDprintf("Small groups (with 0 to %u links):\n", sgroups_threshold-1);
+ HDprintf("Small groups (with 0 to %u links):\n", sgroups_threshold - 1);
total = 0;
- for(u = 0; u < (unsigned)sgroups_threshold; u++) {
- if(iter->num_small_groups[u] > 0) {
+ for (u = 0; u < (unsigned)sgroups_threshold; u++) {
+ if (iter->num_small_groups[u] > 0) {
HDprintf("\t# of groups with %u link(s): %lu\n", u, iter->num_small_groups[u]);
total += iter->num_small_groups[u];
} /* end if */
- } /* end for */
+ } /* end for */
HDprintf("\tTotal # of small groups: %lu\n", total);
HDprintf("Group bins:\n");
total = 0;
- if((iter->group_nbins > 0) && (iter->group_bins[0] > 0)) {
- HDprintf("\t# of groups with 0 link: %lu\n", iter->group_bins[0]);
- total = iter->group_bins[0];
+ if ((iter->group_nbins > 0) && (iter->group_bins[0] > 0)) {
+ HDprintf("\t# of groups with 0 link: %lu\n", iter->group_bins[0]);
+ total = iter->group_bins[0];
} /* end if */
power = 1;
- for(u = 1; u < iter->group_nbins; u++) {
- if(iter->group_bins[u] > 0) {
- HDprintf("\t# of groups with %lu - %lu links: %lu\n", power, (power * 10) - 1,
- iter->group_bins[u]);
- total += iter->group_bins[u];
+ for (u = 1; u < iter->group_nbins; u++) {
+ if (iter->group_bins[u] > 0) {
+ HDprintf("\t# of groups with %lu - %lu links: %lu\n", power, (power * 10) - 1,
+ iter->group_bins[u]);
+ total += iter->group_bins[u];
} /* end if */
power *= 10;
} /* end for */
@@ -1321,7 +1307,6 @@ print_group_info(const iter_t *iter)
return 0;
} /* print_group_info() */
-
/*-------------------------------------------------------------------------
* Function: print_group_metadata
*
@@ -1339,8 +1324,8 @@ print_group_metadata(const iter_t *iter)
{
HDprintf("File space information for groups' metadata (in bytes):\n");
- HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n",
- iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size);
+ HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n", iter->group_ohdr_info.total_size,
+ iter->group_ohdr_info.free_size);
HDfprintf(stdout, "\tB-tree/List: %Hu\n", iter->groups_btree_storage_size);
HDfprintf(stdout, "\tHeap: %Hu\n", iter->groups_heap_storage_size);
@@ -1348,7 +1333,6 @@ print_group_metadata(const iter_t *iter)
return 0;
} /* print_group_metadata() */
-
/*-------------------------------------------------------------------------
* Function: print_dataset_info
*
@@ -1365,44 +1349,43 @@ print_group_metadata(const iter_t *iter)
static herr_t
print_dataset_info(const iter_t *iter)
{
- unsigned long power; /* Temporary "power" for bins */
- unsigned long total; /* Total count for various statistics */
- unsigned u; /* Local index variable */
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
- if(iter->uniq_dsets > 0) {
+ if (iter->uniq_dsets > 0) {
HDprintf("Dataset dimension information:\n");
HDprintf("\tMax. rank of datasets: %u\n", iter->max_dset_rank);
HDprintf("\tDataset ranks:\n");
- for(u = 0; u < H5S_MAX_RANK; u++)
- if(iter->dset_rank_count[u] > 0)
+ for (u = 0; u < H5S_MAX_RANK; u++)
+ if (iter->dset_rank_count[u] > 0)
HDprintf("\t\t# of dataset with rank %u: %lu\n", u, iter->dset_rank_count[u]);
HDprintf("1-D Dataset information:\n");
HDfprintf(stdout, "\tMax. dimension size of 1-D datasets: %Hu\n", iter->max_dset_dims);
HDprintf("\tSmall 1-D datasets (with dimension sizes 0 to %u):\n", sdsets_threshold - 1);
total = 0;
- for(u = 0; u < (unsigned)sdsets_threshold; u++) {
- if(iter->small_dset_dims[u] > 0) {
- HDprintf("\t\t# of datasets with dimension sizes %u: %lu\n", u,
- iter->small_dset_dims[u]);
+ for (u = 0; u < (unsigned)sdsets_threshold; u++) {
+ if (iter->small_dset_dims[u] > 0) {
+ HDprintf("\t\t# of datasets with dimension sizes %u: %lu\n", u, iter->small_dset_dims[u]);
total += iter->small_dset_dims[u];
} /* end if */
- } /* end for */
+ } /* end for */
HDprintf("\t\tTotal # of small datasets: %lu\n", total);
/* Protect against no datasets in file */
- if(iter->dset_dim_nbins > 0) {
+ if (iter->dset_dim_nbins > 0) {
HDprintf("\t1-D Dataset dimension bins:\n");
total = 0;
- if(iter->dset_dim_bins[0] > 0) {
+ if (iter->dset_dim_bins[0] > 0) {
HDprintf("\t\t# of datasets with dimension size 0: %lu\n", iter->dset_dim_bins[0]);
total = iter->dset_dim_bins[0];
} /* end if */
power = 1;
- for(u = 1; u < iter->dset_dim_nbins; u++) {
- if(iter->dset_dim_bins[u] > 0) {
- HDprintf("\t\t# of datasets with dimension size %lu - %lu: %lu\n", power, (power * 10) - 1,
- iter->dset_dim_bins[u]);
+ for (u = 1; u < iter->dset_dim_nbins; u++) {
+ if (iter->dset_dim_bins[u] > 0) {
+ HDprintf("\t\t# of datasets with dimension size %lu - %lu: %lu\n", power,
+ (power * 10) - 1, iter->dset_dim_bins[u]);
total += iter->dset_dim_bins[u];
} /* end if */
power *= 10;
@@ -1415,27 +1398,29 @@ print_dataset_info(const iter_t *iter)
HDfprintf(stdout, "\tTotal external raw data size: %Hu\n", iter->dset_external_storage_size);
HDprintf("Dataset layout information:\n");
- for(u = 0; u < H5D_NLAYOUTS; u++)
- HDprintf("\tDataset layout counts[%s]: %lu\n", (u == H5D_COMPACT ? "COMPACT" :
- (u == H5D_CONTIGUOUS ? "CONTIG" : (u == H5D_CHUNKED ? "CHUNKED" : "VIRTUAL"))), iter->dset_layouts[u]);
+ for (u = 0; u < H5D_NLAYOUTS; u++)
+ HDprintf("\tDataset layout counts[%s]: %lu\n",
+ (u == H5D_COMPACT
+ ? "COMPACT"
+ : (u == H5D_CONTIGUOUS ? "CONTIG" : (u == H5D_CHUNKED ? "CHUNKED" : "VIRTUAL"))),
+ iter->dset_layouts[u]);
HDprintf("\tNumber of external files : %lu\n", iter->nexternal);
HDprintf("Dataset filters information:\n");
HDprintf("\tNumber of datasets with:\n");
- HDprintf("\t\tNO filter: %lu\n", iter->dset_comptype[H5Z_FILTER_ERROR+1]);
+ HDprintf("\t\tNO filter: %lu\n", iter->dset_comptype[H5Z_FILTER_ERROR + 1]);
HDprintf("\t\tGZIP filter: %lu\n", iter->dset_comptype[H5Z_FILTER_DEFLATE]);
HDprintf("\t\tSHUFFLE filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SHUFFLE]);
HDprintf("\t\tFLETCHER32 filter: %lu\n", iter->dset_comptype[H5Z_FILTER_FLETCHER32]);
HDprintf("\t\tSZIP filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SZIP]);
HDprintf("\t\tNBIT filter: %lu\n", iter->dset_comptype[H5Z_FILTER_NBIT]);
HDprintf("\t\tSCALEOFFSET filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SCALEOFFSET]);
- HDprintf("\t\tUSER-DEFINED filter: %lu\n", iter->dset_comptype[H5_NFILTERS_IMPL-1]);
+ HDprintf("\t\tUSER-DEFINED filter: %lu\n", iter->dset_comptype[H5_NFILTERS_IMPL - 1]);
} /* end if */
return 0;
} /* print_dataset_info() */
-
/*-------------------------------------------------------------------------
* Function: print_dataset_metadata
*
@@ -1454,17 +1439,15 @@ print_dset_metadata(const iter_t *iter)
{
HDprintf("File space information for datasets' metadata (in bytes):\n");
- HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n",
- iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size);
+ HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n", iter->dset_ohdr_info.total_size,
+ iter->dset_ohdr_info.free_size);
- HDfprintf(stdout, "\tIndex for Chunked datasets: %Hu\n",
- iter->datasets_index_storage_size);
+ HDfprintf(stdout, "\tIndex for Chunked datasets: %Hu\n", iter->datasets_index_storage_size);
HDfprintf(stdout, "\tHeap: %Hu\n", iter->datasets_heap_storage_size);
return 0;
} /* print_dset_metadata() */
-
/*-------------------------------------------------------------------------
* Function: print_dset_dtype_meta
*
@@ -1481,21 +1464,21 @@ print_dset_metadata(const iter_t *iter)
static herr_t
print_dset_dtype_meta(const iter_t *iter)
{
- unsigned long total; /* Total count for various statistics */
- size_t dtype_size; /* Size of encoded datatype */
- unsigned u; /* Local index variable */
+ unsigned long total; /* Total count for various statistics */
+ size_t dtype_size; /* Size of encoded datatype */
+ unsigned u; /* Local index variable */
- if(iter->dset_ntypes) {
+ if (iter->dset_ntypes) {
HDprintf("Dataset datatype information:\n");
HDprintf("\t# of unique datatypes used by datasets: %lu\n", iter->dset_ntypes);
total = 0;
- for(u = 0; u < iter->dset_ntypes; u++) {
+ for (u = 0; u < iter->dset_ntypes; u++) {
H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size);
HDprintf("\tDataset datatype #%u:\n", u);
- HDprintf("\t\tCount (total/named) = (%lu/%lu)\n",
- iter->dset_type_info[u].count, iter->dset_type_info[u].named);
+ HDprintf("\t\tCount (total/named) = (%lu/%lu)\n", iter->dset_type_info[u].count,
+ iter->dset_type_info[u].named);
HDprintf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size,
- (unsigned long)H5Tget_size(iter->dset_type_info[u].tid));
+ (unsigned long)H5Tget_size(iter->dset_type_info[u].tid));
H5Tclose(iter->dset_type_info[u].tid);
total += iter->dset_type_info[u].count;
} /* end for */
@@ -1505,7 +1488,6 @@ print_dset_dtype_meta(const iter_t *iter)
return 0;
} /* print_dset_dtype_meta() */
-
/*-------------------------------------------------------------------------
* Function: print_attr_info
*
@@ -1523,28 +1505,28 @@ print_dset_dtype_meta(const iter_t *iter)
static herr_t
print_attr_info(const iter_t *iter)
{
- unsigned long power; /* Temporary "power" for bins */
- unsigned long total; /* Total count for various statistics */
- unsigned u; /* Local index variable */
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
HDprintf("Small # of attributes (objects with 1 to %u attributes):\n", sattrs_threshold);
total = 0;
- for(u = 1; u <= (unsigned)sattrs_threshold; u++) {
- if(iter->num_small_attrs[u] > 0) {
+ for (u = 1; u <= (unsigned)sattrs_threshold; u++) {
+ if (iter->num_small_attrs[u] > 0) {
HDprintf("\t# of objects with %u attributes: %lu\n", u, iter->num_small_attrs[u]);
total += iter->num_small_attrs[u];
} /* end if */
- } /* end for */
+ } /* end for */
HDprintf("\tTotal # of objects with small # of attributes: %lu\n", total);
HDprintf("Attribute bins:\n");
total = 0;
power = 1;
- for(u = 1; u < iter->attr_nbins; u++) {
- if(iter->attr_bins[u] > 0) {
- HDprintf("\t# of objects with %lu - %lu attributes: %lu\n", power, (power * 10) - 1,
- iter->attr_bins[u]);
- total += iter->attr_bins[u];
+ for (u = 1; u < iter->attr_nbins; u++) {
+ if (iter->attr_bins[u] > 0) {
+ HDprintf("\t# of objects with %lu - %lu attributes: %lu\n", power, (power * 10) - 1,
+ iter->attr_bins[u]);
+ total += iter->attr_bins[u];
} /* end if */
power *= 10;
} /* end for */
@@ -1554,7 +1536,6 @@ print_attr_info(const iter_t *iter)
return 0;
} /* print_attr_info() */
-
/*-------------------------------------------------------------------------
* Function: print_freespace_info
*
@@ -1571,31 +1552,30 @@ print_attr_info(const iter_t *iter)
static herr_t
print_freespace_info(const iter_t *iter)
{
- unsigned long power; /* Temporary "power" for bins */
- unsigned long total; /* Total count for various statistics */
- unsigned u; /* Local index variable */
+ unsigned long power; /* Temporary "power" for bins */
+ unsigned long total; /* Total count for various statistics */
+ unsigned u; /* Local index variable */
HDfprintf(stdout, "Free-space persist: %s\n", iter->fs_persist ? "TRUE" : "FALSE");
HDfprintf(stdout, "Free-space section threshold: %Hu bytes\n", iter->fs_threshold);
HDprintf("Small size free-space sections (< %u bytes):\n", (unsigned)SIZE_SMALL_SECTS);
total = 0;
- for(u = 0; u < SIZE_SMALL_SECTS; u++) {
- if(iter->num_small_sects[u] > 0) {
+ for (u = 0; u < SIZE_SMALL_SECTS; u++) {
+ if (iter->num_small_sects[u] > 0) {
HDprintf("\t# of sections of size %u: %lu\n", u, iter->num_small_sects[u]);
total += iter->num_small_sects[u];
} /* end if */
- } /* end for */
+ } /* end for */
HDprintf("\tTotal # of small size sections: %lu\n", total);
HDprintf("Free-space section bins:\n");
total = 0;
power = 1;
- for(u = 1; u < iter->sect_nbins; u++) {
- if(iter->sect_bins[u] > 0) {
- HDprintf("\t# of sections of size %lu - %lu: %lu\n", power, (power * 10) - 1,
- iter->sect_bins[u]);
- total += iter->sect_bins[u];
+ for (u = 1; u < iter->sect_nbins; u++) {
+ if (iter->sect_bins[u] > 0) {
+ HDprintf("\t# of sections of size %lu - %lu: %lu\n", power, (power * 10) - 1, iter->sect_bins[u]);
+ total += iter->sect_bins[u];
} /* end if */
power *= 10;
} /* end for */
@@ -1604,7 +1584,6 @@ print_freespace_info(const iter_t *iter)
return 0;
} /* print_freespace_info() */
-
/*-------------------------------------------------------------------------
* Function: print_storage_summary
*
@@ -1622,36 +1601,27 @@ static herr_t
print_storage_summary(const iter_t *iter)
{
hsize_t total_meta = 0;
- hsize_t unaccount = 0;
- double percent = 0.0f;
+ hsize_t unaccount = 0;
+ double percent = 0.0f;
HDfprintf(stdout, "File space management strategy: %s\n", FS_STRATEGY_NAME[iter->fs_strategy]);
HDfprintf(stdout, "File space page size: %Hu bytes\n", iter->fsp_size);
HDprintf("Summary of file space information:\n");
total_meta =
- iter->super_size + iter->super_ext_size + iter->ublk_size +
- iter->group_ohdr_info.total_size +
- iter->dset_ohdr_info.total_size +
- iter->dtype_ohdr_info.total_size +
- iter->groups_btree_storage_size +
- iter->groups_heap_storage_size +
- iter->attrs_btree_storage_size +
- iter->attrs_heap_storage_size +
- iter->datasets_index_storage_size +
- iter->datasets_heap_storage_size +
- iter->SM_hdr_storage_size +
- iter->SM_index_storage_size +
- iter->SM_heap_storage_size +
- iter->free_hdr;
+ iter->super_size + iter->super_ext_size + iter->ublk_size + iter->group_ohdr_info.total_size +
+ iter->dset_ohdr_info.total_size + iter->dtype_ohdr_info.total_size + iter->groups_btree_storage_size +
+ iter->groups_heap_storage_size + iter->attrs_btree_storage_size + iter->attrs_heap_storage_size +
+ iter->datasets_index_storage_size + iter->datasets_heap_storage_size + iter->SM_hdr_storage_size +
+ iter->SM_index_storage_size + iter->SM_heap_storage_size + iter->free_hdr;
HDfprintf(stdout, " File metadata: %Hu bytes\n", total_meta);
HDfprintf(stdout, " Raw data: %Hu bytes\n", iter->dset_storage_size);
percent = ((double)iter->free_space / (double)iter->filesize) * (double)100.0f;
- HDfprintf(stdout, " Amount/Percent of tracked free space: %Hu bytes/%3.1f%\n",
- iter->free_space, percent);
+ HDfprintf(stdout, " Amount/Percent of tracked free space: %Hu bytes/%3.1f%\n", iter->free_space,
+ percent);
- if(iter->filesize < (total_meta + iter->dset_storage_size + iter->free_space)) {
+ if (iter->filesize < (total_meta + iter->dset_storage_size + iter->free_space)) {
unaccount = (total_meta + iter->dset_storage_size + iter->free_space) - iter->filesize;
HDfprintf(stdout, " ??? File has %Hu more bytes accounted for than its size! ???\n", unaccount);
}
@@ -1660,15 +1630,15 @@ print_storage_summary(const iter_t *iter)
HDfprintf(stdout, " Unaccounted space: %Hu bytes\n", unaccount);
}
- HDfprintf(stdout, "Total space: %Hu bytes\n", total_meta + iter->dset_storage_size + iter->free_space + unaccount);
+ HDfprintf(stdout, "Total space: %Hu bytes\n",
+ total_meta + iter->dset_storage_size + iter->free_space + unaccount);
- if(iter->nexternal)
+ if (iter->nexternal)
HDfprintf(stdout, "External raw data: %Hu bytes\n", iter->dset_external_storage_size);
return 0;
} /* print_storage_summary() */
-
/*-------------------------------------------------------------------------
* Function: print_file_statistics
*
@@ -1686,36 +1656,45 @@ print_storage_summary(const iter_t *iter)
static void
print_file_statistics(const iter_t *iter)
{
- if(display_all) {
- display_file = TRUE;
- display_group = TRUE;
- display_dset = TRUE;
+ if (display_all) {
+ display_file = TRUE;
+ display_group = TRUE;
+ display_dset = TRUE;
display_dset_dtype_meta = TRUE;
- display_attr = TRUE;
- display_free_sections = TRUE;
- display_summary = TRUE;
+ display_attr = TRUE;
+ display_free_sections = TRUE;
+ display_summary = TRUE;
- display_file_metadata = TRUE;
+ display_file_metadata = TRUE;
display_group_metadata = TRUE;
- display_dset_metadata = TRUE;
+ display_dset_metadata = TRUE;
}
- if(display_file) print_file_info(iter);
- if(display_file_metadata) print_file_metadata(iter);
-
- if(display_group) print_group_info(iter);
- if(!display_all && display_group_metadata) print_group_metadata(iter);
-
- if(display_dset) print_dataset_info(iter);
- if(display_dset_dtype_meta) print_dset_dtype_meta(iter);
- if(!display_all && display_dset_metadata) print_dset_metadata(iter);
-
- if(display_attr) print_attr_info(iter);
- if(display_free_sections) print_freespace_info(iter);
- if(display_summary) print_storage_summary(iter);
+ if (display_file)
+ print_file_info(iter);
+ if (display_file_metadata)
+ print_file_metadata(iter);
+
+ if (display_group)
+ print_group_info(iter);
+ if (!display_all && display_group_metadata)
+ print_group_metadata(iter);
+
+ if (display_dset)
+ print_dataset_info(iter);
+ if (display_dset_dtype_meta)
+ print_dset_dtype_meta(iter);
+ if (!display_all && display_dset_metadata)
+ print_dset_metadata(iter);
+
+ if (display_attr)
+ print_attr_info(iter);
+ if (display_free_sections)
+ print_freespace_info(iter);
+ if (display_summary)
+ print_storage_summary(iter);
} /* print_file_statistics() */
-
/*-------------------------------------------------------------------------
* Function: print_object_statistics
*
@@ -1738,7 +1717,6 @@ print_object_statistics(const char *name)
HDprintf("Object name %s\n", name);
} /* print_object_statistics() */
-
/*-------------------------------------------------------------------------
* Function: print_statistics
*
@@ -1758,13 +1736,12 @@ print_object_statistics(const char *name)
static void
print_statistics(const char *name, const iter_t *iter)
{
- if(display_object)
+ if (display_object)
print_object_statistics(name);
else
print_file_statistics(iter);
} /* print_statistics() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1777,11 +1754,11 @@ print_statistics(const char *name, const iter_t *iter)
int
main(int argc, const char *argv[])
{
- iter_t iter;
- const char *fname = NULL;
- hid_t fid = H5I_INVALID_HID;
- struct handler_t *hand = NULL;
- hid_t fapl_id = H5P_DEFAULT;
+ iter_t iter;
+ const char * fname = NULL;
+ hid_t fid = H5I_INVALID_HID;
+ struct handler_t *hand = NULL;
+ hid_t fapl_id = H5P_DEFAULT;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -1791,7 +1768,7 @@ main(int argc, const char *argv[])
HDmemset(&iter, 0, sizeof(iter));
- if(parse_command_line(argc, argv, &hand) < 0)
+ if (parse_command_line(argc, argv, &hand) < 0)
goto done;
/* enable error reporting if command line option */
@@ -1800,8 +1777,8 @@ main(int argc, const char *argv[])
if (drivername) {
h5tools_vfd_info_t vfd_info;
- vfd_info.info = NULL;
- vfd_info.name = drivername;
+ vfd_info.info = NULL;
+ vfd_info.name = drivername;
if (!HDstrcmp(drivername, drivernames[ROS3_VFD_IDX])) {
#ifdef H5_HAVE_ROS3_VFD
@@ -1829,16 +1806,15 @@ main(int argc, const char *argv[])
fname = argv[opt_ind];
/* Check for filename given */
- if(fname) {
- hid_t fcpl;
- H5F_info2_t finfo;
+ if (fname) {
+ hid_t fcpl;
+ H5F_info2_t finfo;
HDprintf("Filename: %s\n", fname);
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id,
- (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0);
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0);
- if(fid < 0) {
+ if (fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -1847,72 +1823,74 @@ main(int argc, const char *argv[])
/* Initialize iter structure */
iter.fid = fid;
- if(H5Fget_filesize(fid, &iter.filesize) < 0)
+ if (H5Fget_filesize(fid, &iter.filesize) < 0)
warn_msg("Unable to retrieve file size\n");
HDassert(iter.filesize != 0);
/* Get storge info for file-level structures */
- if(H5Fget_info2(fid, &finfo) < 0)
+ if (H5Fget_info2(fid, &finfo) < 0)
warn_msg("Unable to retrieve file info\n");
else {
- iter.super_size = finfo.super.super_size;
- iter.super_ext_size = finfo.super.super_ext_size;
- iter.SM_hdr_storage_size = finfo.sohm.hdr_size;
+ iter.super_size = finfo.super.super_size;
+ iter.super_ext_size = finfo.super.super_ext_size;
+ iter.SM_hdr_storage_size = finfo.sohm.hdr_size;
iter.SM_index_storage_size = finfo.sohm.msgs_info.index_size;
- iter.SM_heap_storage_size = finfo.sohm.msgs_info.heap_size;
- iter.free_space = finfo.free.tot_space;
- iter.free_hdr = finfo.free.meta_size;
+ iter.SM_heap_storage_size = finfo.sohm.msgs_info.heap_size;
+ iter.free_space = finfo.free.tot_space;
+ iter.free_hdr = finfo.free.meta_size;
} /* end else */
iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long));
- iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long));
+ iter.num_small_attrs =
+ (unsigned long *)HDcalloc((size_t)(sattrs_threshold + 1), sizeof(unsigned long));
iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long));
- if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) {
+ if (iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) {
error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- if((fcpl = H5Fget_create_plist(fid)) < 0)
+ if ((fcpl = H5Fget_create_plist(fid)) < 0)
warn_msg("Unable to retrieve file creation property\n");
- if(H5Pget_userblock(fcpl, &iter.ublk_size) < 0)
+ if (H5Pget_userblock(fcpl, &iter.ublk_size) < 0)
warn_msg("Unable to retrieve userblock size\n");
- if(H5Pget_file_space_strategy(fcpl, &iter.fs_strategy, &iter.fs_persist, &iter.fs_threshold) < 0)
+ if (H5Pget_file_space_strategy(fcpl, &iter.fs_strategy, &iter.fs_persist, &iter.fs_threshold) < 0)
warn_msg("Unable to retrieve file space information\n");
HDassert(iter.fs_strategy >= 0 && iter.fs_strategy < H5F_FSPACE_STRATEGY_NTYPES);
- if(H5Pget_file_space_page_size(fcpl, &iter.fsp_size) < 0)
+ if (H5Pget_file_space_page_size(fcpl, &iter.fsp_size) < 0)
warn_msg("Unable to retrieve file space page size\n");
/* get information for free-space sections */
- if(freespace_stats(fid, &iter) < 0)
+ if (freespace_stats(fid, &iter) < 0)
warn_msg("Unable to retrieve freespace info\n");
/* Walk the objects or all file */
- if(display_object) {
+ if (display_object) {
unsigned u;
- for(u = 0; u < hand->obj_count; u++) {
- if(h5trav_visit(fid, hand->obj[u], TRUE, TRUE, obj_stats, lnk_stats, &iter, H5O_INFO_ALL) < 0) {
+ for (u = 0; u < hand->obj_count; u++) {
+ if (h5trav_visit(fid, hand->obj[u], TRUE, TRUE, obj_stats, lnk_stats, &iter, H5O_INFO_ALL) <
+ 0) {
error_msg("unable to traverse object \"%s\"\n", hand->obj[u]);
h5tools_setstatus(EXIT_FAILURE);
}
else
print_statistics(hand->obj[u], &iter);
} /* end for */
- } /* end if */
+ } /* end if */
else {
- if(h5trav_visit(fid, "/", TRUE, TRUE, obj_stats, lnk_stats, &iter, H5O_INFO_ALL) < 0) {
+ if (h5trav_visit(fid, "/", TRUE, TRUE, obj_stats, lnk_stats, &iter, H5O_INFO_ALL) < 0) {
error_msg("unable to traverse objects/links in file \"%s\"\n", fname);
h5tools_setstatus(EXIT_FAILURE);
}
else
print_statistics("/", &iter);
} /* end else */
- } /* end if */
+ } /* end if */
done:
hand_free(hand);
@@ -1927,11 +1905,10 @@ done:
}
}
- if(fid >= 0 && H5Fclose(fid) < 0) {
+ if (fid >= 0 && H5Fclose(fid) < 0) {
error_msg("unable to close file \"%s\"\n", fname);
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
leave(h5tools_getstatus());
} /* end main() */
-
diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c
index 96cbf9c..0ef9483 100644
--- a/tools/src/misc/h5clear.c
+++ b/tools/src/misc/h5clear.c
@@ -24,64 +24,60 @@
#include "h5tools_utils.h"
/* Name of tool */
-#define PROGRAMNAME "h5clear"
+#define PROGRAMNAME "h5clear"
/* Make these private properties (defined in H5Fprivate.h) available to h5clear. */
-#define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags"
-#define H5F_ACS_NULL_FSM_ADDR_NAME "null_fsm_addr"
-#define H5F_ACS_SKIP_EOF_CHECK_NAME "skip_eof_check"
+#define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags"
+#define H5F_ACS_NULL_FSM_ADDR_NAME "null_fsm_addr"
+#define H5F_ACS_SKIP_EOF_CHECK_NAME "skip_eof_check"
/* Default increment is 1 megabytes for the --increment option */
-#define DEFAULT_INCREMENT 1024*1024
+#define DEFAULT_INCREMENT 1024 * 1024
-static char *fname_g = NULL;
+static char * fname_g = NULL;
static hbool_t clear_status_flags = FALSE;
static hbool_t remove_cache_image = FALSE;
-static hbool_t print_filesize = FALSE;
-static hbool_t increment_eoa_eof = FALSE;
-static hsize_t increment = DEFAULT_INCREMENT;
+static hbool_t print_filesize = FALSE;
+static hbool_t increment_eoa_eof = FALSE;
+static hsize_t increment = DEFAULT_INCREMENT;
/*
* Command-line options: only publicize long options
*/
-static const char *s_opts = "hVsmzi*";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "hel", no_arg, 'h'},
- { "he", no_arg, 'h'},
- { "version", no_arg, 'V' },
- { "version", no_arg, 'V' },
- { "versio", no_arg, 'V' },
- { "versi", no_arg, 'V' },
- { "vers", no_arg, 'V' },
- { "status", no_arg, 's' },
- { "statu", no_arg, 's' },
- { "stat", no_arg, 's' },
- { "sta", no_arg, 's' },
- { "st", no_arg, 's' },
- { "image", no_arg, 'm' },
- { "imag", no_arg, 'm' },
- { "ima", no_arg, 'm' },
- { "im", no_arg, 'm' },
- { "filesize", no_arg, 'z' },
- { "filesiz", no_arg, 'z' },
- { "filesi", no_arg, 'z' },
- { "files", no_arg, 'z' },
- { "file", no_arg, 'z' },
- { "fil", no_arg, 'z' },
- { "fi", no_arg, 'z' },
- { "increment", optional_arg, 'i' },
- { "incremen", optional_arg, 'i' },
- { "increme", optional_arg, 'i' },
- { "increm", optional_arg, 'i' },
- { "incre", optional_arg, 'i' },
- { "incr", optional_arg, 'i' },
- { "inc", optional_arg, 'i' },
- { "in", optional_arg, 'i' },
- { NULL, 0, '\0' }
-};
-
-
+static const char * s_opts = "hVsmzi*";
+static struct long_options l_opts[] = {{"help", no_arg, 'h'},
+ {"hel", no_arg, 'h'},
+ {"he", no_arg, 'h'},
+ {"version", no_arg, 'V'},
+ {"version", no_arg, 'V'},
+ {"versio", no_arg, 'V'},
+ {"versi", no_arg, 'V'},
+ {"vers", no_arg, 'V'},
+ {"status", no_arg, 's'},
+ {"statu", no_arg, 's'},
+ {"stat", no_arg, 's'},
+ {"sta", no_arg, 's'},
+ {"st", no_arg, 's'},
+ {"image", no_arg, 'm'},
+ {"imag", no_arg, 'm'},
+ {"ima", no_arg, 'm'},
+ {"im", no_arg, 'm'},
+ {"filesize", no_arg, 'z'},
+ {"filesiz", no_arg, 'z'},
+ {"filesi", no_arg, 'z'},
+ {"files", no_arg, 'z'},
+ {"file", no_arg, 'z'},
+ {"fil", no_arg, 'z'},
+ {"fi", no_arg, 'z'},
+ {"increment", optional_arg, 'i'},
+ {"incremen", optional_arg, 'i'},
+ {"increme", optional_arg, 'i'},
+ {"increm", optional_arg, 'i'},
+ {"incre", optional_arg, 'i'},
+ {"incr", optional_arg, 'i'},
+ {"inc", optional_arg, 'i'},
+ {"in", optional_arg, 'i'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -92,7 +88,8 @@ static struct long_options l_opts[] = {
*
*-------------------------------------------------------------------------
*/
-static void usage(const char *prog)
+static void
+usage(const char *prog)
{
HDfprintf(stdout, "usage: %s [OPTIONS] file_name\n", prog);
HDfprintf(stdout, " OPTIONS\n");
@@ -101,12 +98,17 @@ static void usage(const char *prog)
HDfprintf(stdout, " -s, --status Clear the status_flags field in the file's superblock\n");
HDfprintf(stdout, " -m, --image Remove the metadata cache image from the file\n");
HDfprintf(stdout, " --filesize Print the file's EOA and EOF\n");
- HDfprintf(stdout, " --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for\n");
+ HDfprintf(stdout,
+ " --increment=C Set the file's EOA to the maximum of (EOA, EOF) + C for\n");
HDfprintf(stdout, " the file <file_name>.\n");
- HDfprintf(stdout, " C is >= 0; C is optional and will default to 1M when not set.\n");
- HDfprintf(stdout, " This option helps to repair a crashed file where the stored EOA\n");
+ HDfprintf(stdout,
+ " C is >= 0; C is optional and will default to 1M when not set.\n");
+ HDfprintf(
+ stdout,
+ " This option helps to repair a crashed file where the stored EOA\n");
HDfprintf(stdout, " in the superblock is different from the actual EOF.\n");
- HDfprintf(stdout, " The file’s EOA and EOF will be the same after applying\n");
+ HDfprintf(stdout,
+ " The file’s EOA and EOF will be the same after applying\n");
HDfprintf(stdout, " this option to the file.\n");
HDfprintf(stdout, "\n");
HDfprintf(stdout, "Examples of use:\n");
@@ -124,7 +126,6 @@ static void usage(const char *prog)
HDfprintf(stdout, " Set the EOA to the maximum of (EOA, EOF) + 512 for the file <file_name>.\n");
} /* usage() */
-
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -141,7 +142,7 @@ parse_command_line(int argc, const char **argv)
{
int opt;
- /* no arguments */
+ /* no arguments */
if (argc == 1) {
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
@@ -149,8 +150,8 @@ parse_command_line(int argc, const char **argv)
}
/* parse command line options */
- while((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch((char)opt) {
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
case 'h':
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_SUCCESS);
@@ -175,7 +176,7 @@ parse_command_line(int argc, const char **argv)
case 'i':
increment_eoa_eof = TRUE;
- if(opt_arg != NULL) {
+ if (opt_arg != NULL) {
if (HDatoi(opt_arg) < 0) {
usage(h5tools_getprogname());
goto done;
@@ -189,10 +190,10 @@ parse_command_line(int argc, const char **argv)
h5tools_setstatus(EXIT_FAILURE);
goto error;
} /* end switch */
- } /* end while */
+ } /* end while */
/* check for file name to be processed */
- if(argc <= opt_ind) {
+ if (argc <= opt_ind) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
@@ -202,7 +203,7 @@ parse_command_line(int argc, const char **argv)
fname_g = HDstrdup(argv[opt_ind]);
done:
- return(0);
+ return (0);
error:
return -1;
@@ -224,8 +225,6 @@ leave(int ret)
HDexit(ret);
} /* leave() */
-
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -254,14 +253,14 @@ leave(int ret)
*-------------------------------------------------------------------------
*/
int
-main (int argc, const char *argv[])
+main(int argc, const char *argv[])
{
- char *fname = NULL; /* File name */
- hid_t fapl = H5I_INVALID_HID; /* File access property list */
- hid_t fid = H5I_INVALID_HID; /* File ID */
- haddr_t image_addr;
- hsize_t image_len;
- unsigned flags = H5F_ACC_RDWR; /* file access flags */
+ char * fname = NULL; /* File name */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ haddr_t image_addr;
+ hsize_t image_len;
+ unsigned flags = H5F_ACC_RDWR; /* file access flags */
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -270,26 +269,24 @@ main (int argc, const char *argv[])
h5tools_init();
/* Parse command line options */
- if(parse_command_line(argc, argv) < 0)
+ if (parse_command_line(argc, argv) < 0)
goto done;
- if(fname_g == NULL)
+ if (fname_g == NULL)
goto done;
/* enable error reporting if command line option */
h5tools_error_report();
/* Print usage/exit if not using at least one of the options */
- if(!clear_status_flags && !remove_cache_image &&
- !increment_eoa_eof && !print_filesize) {
+ if (!clear_status_flags && !remove_cache_image && !increment_eoa_eof && !print_filesize) {
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* Cannot combine the --filesize option with other options */
- if(print_filesize &&
- (clear_status_flags || remove_cache_image || increment_eoa_eof)) {
+ if (print_filesize && (clear_status_flags || remove_cache_image || increment_eoa_eof)) {
error_msg("Cannot combine --filesize with other options\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -299,17 +296,17 @@ main (int argc, const char *argv[])
fname = HDstrdup(fname_g);
/* Get a copy of the file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
error_msg("H5Pcreate\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
/* -s option */
- if(clear_status_flags) {
+ if (clear_status_flags) {
/* Set to clear the status_flags in the file's superblock */
/* Activate this private property */
- if(H5Pset(fapl, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear_status_flags) < 0) {
+ if (H5Pset(fapl, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear_status_flags) < 0) {
error_msg("H5Pset\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -317,15 +314,15 @@ main (int argc, const char *argv[])
}
/* --increment option */
- if(increment_eoa_eof) {
+ if (increment_eoa_eof) {
/* Activate this private property */
- if(H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &increment_eoa_eof) < 0) {
+ if (H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &increment_eoa_eof) < 0) {
error_msg("H5Pset\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* Activate this private property */
- if(H5Pset(fapl, H5F_ACS_NULL_FSM_ADDR_NAME, &increment_eoa_eof) < 0) {
+ if (H5Pset(fapl, H5F_ACS_NULL_FSM_ADDR_NAME, &increment_eoa_eof) < 0) {
error_msg("H5Pset\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -333,9 +330,9 @@ main (int argc, const char *argv[])
}
/* --filesize option; open the file read-only */
- if(print_filesize) {
+ if (print_filesize) {
/* Activate this private property */
- if(H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &print_filesize) < 0) {
+ if (H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &print_filesize) < 0) {
error_msg("H5Pset\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -344,19 +341,19 @@ main (int argc, const char *argv[])
}
/* Open the file */
- if((fid = h5tools_fopen(fname, flags, fapl, FALSE, NULL, (size_t)0)) < 0) {
+ if ((fid = h5tools_fopen(fname, flags, fapl, FALSE, NULL, (size_t)0)) < 0) {
error_msg("h5tools_fopen\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* --filesize option */
- if(print_filesize) {
- h5_stat_t st; /* Stat info call */
- haddr_t eoa; /* The EOA value */
+ if (print_filesize) {
+ h5_stat_t st; /* Stat info call */
+ haddr_t eoa; /* The EOA value */
/* Get the file's EOA and EOF */
- if(H5Fget_eoa(fid, &eoa) < 0 || HDstat(fname, &st) < 0) {
+ if (H5Fget_eoa(fid, &eoa) < 0 || HDstat(fname, &st) < 0) {
error_msg("H5Fget_eoa or HDstat\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -365,9 +362,9 @@ main (int argc, const char *argv[])
}
/* --increment option */
- if(increment_eoa_eof) {
+ if (increment_eoa_eof) {
/* Set the file's EOA to the maximum of (EOA, EOF) + increment */
- if(H5Fincrement_filesize(fid, increment) < 0) {
+ if (H5Fincrement_filesize(fid, increment) < 0) {
error_msg("H5Fset_eoa\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -375,29 +372,30 @@ main (int argc, const char *argv[])
}
/* -m option */
- if(remove_cache_image) {
- if(H5Fget_mdc_image_info(fid, &image_addr, &image_len) < 0) {
+ if (remove_cache_image) {
+ if (H5Fget_mdc_image_info(fid, &image_addr, &image_len) < 0) {
error_msg("H5Fget_mdc_image_info\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- if(image_addr == HADDR_UNDEF && image_len == 0)
+ if (image_addr == HADDR_UNDEF && image_len == 0)
warn_msg("No cache image in the file\n");
}
h5tools_setstatus(EXIT_SUCCESS);
done:
- if(fname)
+ if (fname)
HDfree(fname);
- if(fname_g)
+ if (fname_g)
HDfree(fname_g);
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY
+ }
+ H5E_END_TRY
leave(h5tools_getstatus());
} /* main() */
-
diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c
index bc7e9a3..ae9ec93 100644
--- a/tools/src/misc/h5debug.c
+++ b/tools/src/misc/h5debug.c
@@ -21,42 +21,41 @@
*
*-------------------------------------------------------------------------
*/
-#define H5A_FRIEND /*suppress error about including H5Apkg */
-#define H5B2_FRIEND /*suppress error about including H5B2pkg */
-#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
-#define H5D_FRIEND /*suppress error about including H5Dpkg */
-#define H5EA_FRIEND /*suppress error about including H5EApkg */
-#define H5EA_TESTING /*suppress warning about H5EA testing funcs*/
-#define H5FA_FRIEND /*suppress error about including H5FApkg */
-#define H5FA_TESTING /*suppress warning about H5FA testing funcs*/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
-#define H5HF_FRIEND /*suppress error about including H5HFpkg */
-#define H5O_FRIEND /*suppress error about including H5Opkg */
-#define H5SM_FRIEND /*suppress error about including H5SMpkg */
-
-#include "H5private.h" /* Generic Functions */
-#include "H5Apkg.h" /* Attributes */
-#include "H5B2pkg.h" /* v2 B-trees */
+#define H5A_FRIEND /*suppress error about including H5Apkg */
+#define H5B2_FRIEND /*suppress error about including H5B2pkg */
+#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5EA_FRIEND /*suppress error about including H5EApkg */
+#define H5EA_TESTING /*suppress warning about H5EA testing funcs*/
+#define H5FA_FRIEND /*suppress error about including H5FApkg */
+#define H5FA_TESTING /*suppress warning about H5FA testing funcs*/
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5HF_FRIEND /*suppress error about including H5HFpkg */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5SM_FRIEND /*suppress error about including H5SMpkg */
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Apkg.h" /* Attributes */
+#include "H5B2pkg.h" /* v2 B-trees */
#include "H5CXprivate.h" /* API Contexts */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5EApkg.h" /* Extensible Arrays */
-#include "H5FApkg.h" /* Fixed Arrays */
-#include "H5Fpkg.h" /* File access */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5FApkg.h" /* Fixed Arrays */
+#include "H5Fpkg.h" /* File access */
#include "H5FSprivate.h" /* Free space manager */
-#include "H5Gpkg.h" /* Groups */
-#include "H5HFpkg.h" /* Fractal heaps */
+#include "H5Gpkg.h" /* Groups */
+#include "H5HFpkg.h" /* Fractal heaps */
#include "H5HGprivate.h" /* Global Heaps */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Opkg.h" /* Object headers */
-#include "H5SMpkg.h" /* Implicitly shared messages */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Opkg.h" /* Object headers */
+#include "H5SMpkg.h" /* Implicitly shared messages */
/* File drivers */
#include "H5FDfamily.h"
-#define VCOL 50
-
+#define VCOL 50
/*-------------------------------------------------------------------------
* Function: get_H5B2_class
@@ -75,10 +74,10 @@
static const H5B2_class_t *
get_H5B2_class(const uint8_t *sig)
{
- H5B2_subid_t subtype = (H5B2_subid_t)sig[H5_SIZEOF_MAGIC + 1];
- const H5B2_class_t *cls = NULL;
+ H5B2_subid_t subtype = (H5B2_subid_t)sig[H5_SIZEOF_MAGIC + 1];
+ const H5B2_class_t *cls = NULL;
- switch(subtype) {
+ switch (subtype) {
case H5B2_TEST_ID:
cls = H5B2_TEST;
break;
@@ -136,10 +135,9 @@ get_H5B2_class(const uint8_t *sig)
HDfprintf(stderr, "Unknown v2 B-tree subtype %u\n", (unsigned)(subtype));
} /* end switch */
- return(cls);
+ return (cls);
} /* end get_H5B2_class() */
-
/*-------------------------------------------------------------------------
* Function: get_H5EA_class
*
@@ -157,10 +155,10 @@ get_H5B2_class(const uint8_t *sig)
static const H5EA_class_t *
get_H5EA_class(const uint8_t *sig)
{
- H5EA_cls_id_t clsid = (H5EA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1];
- const H5EA_class_t *cls = NULL;
+ H5EA_cls_id_t clsid = (H5EA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1];
+ const H5EA_class_t *cls = NULL;
- switch(clsid) {
+ switch (clsid) {
case H5EA_CLS_TEST_ID:
cls = H5EA_CLS_TEST;
break;
@@ -178,10 +176,9 @@ get_H5EA_class(const uint8_t *sig)
HDfprintf(stderr, "Unknown extensible array class %u\n", (unsigned)(clsid));
} /* end switch */
- return(cls);
+ return (cls);
} /* end get_H5EA_class() */
-
/*-------------------------------------------------------------------------
* Function: get_H5FA_class
*
@@ -199,10 +196,10 @@ get_H5EA_class(const uint8_t *sig)
static const H5FA_class_t *
get_H5FA_class(const uint8_t *sig)
{
- H5FA_cls_id_t clsid = (H5FA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1];
- const H5FA_class_t *cls = NULL;
+ H5FA_cls_id_t clsid = (H5FA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1];
+ const H5FA_class_t *cls = NULL;
- switch(clsid) {
+ switch (clsid) {
case H5FA_CLS_TEST_ID:
cls = H5FA_CLS_TEST;
break;
@@ -220,10 +217,9 @@ get_H5FA_class(const uint8_t *sig)
HDfprintf(stderr, "Unknown fixed array class %u\n", (unsigned)(clsid));
} /* end switch */
- return(cls);
+ return (cls);
} /* end get_H5FA_class() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -241,28 +237,28 @@ get_H5FA_class(const uint8_t *sig)
int
main(int argc, char *argv[])
{
- hid_t fid = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
hid_t fapl = H5I_INVALID_HID;
- H5F_t *f;
- haddr_t addr = 0;
- int extra_count = 0; /* Number of extra arguments */
+ H5F_t * f;
+ haddr_t addr = 0;
+ int extra_count = 0; /* Number of extra arguments */
haddr_t extra[10];
uint8_t sig[H5F_SIGNATURE_LEN];
size_t u;
H5E_auto2_t func;
- void *edata;
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
- herr_t status = SUCCEED;
- int exit_value = 0;
+ void * edata;
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ herr_t status = SUCCEED;
+ int exit_value = 0;
- if(argc == 1) {
+ if (argc == 1) {
HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]*]\n", argv[0]);
exit_value = 1;
goto done;
} /* end if */
/* Initialize the library */
- if(H5open() < 0) {
+ if (H5open() < 0) {
HDfprintf(stderr, "cannot initialize the library\n");
exit_value = 1;
goto done;
@@ -275,39 +271,39 @@ main(int argc, char *argv[])
/*
* Open the file and get the file descriptor.
*/
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
HDfprintf(stderr, "cannot create file access property list\n");
exit_value = 1;
goto done;
} /* end if */
- if(HDstrchr(argv[1], '%'))
- if(H5Pset_fapl_family (fapl, (hsize_t)0, H5P_DEFAULT) < 0) {
+ if (HDstrchr(argv[1], '%'))
+ if (H5Pset_fapl_family(fapl, (hsize_t)0, H5P_DEFAULT) < 0) {
HDfprintf(stderr, "cannot set file access property list\n");
exit_value = 1;
goto done;
}
- if((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0) {
+ if ((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0) {
HDfprintf(stderr, "cannot open file\n");
exit_value = 1;
goto done;
} /* end if */
/* Push API context */
- if(H5CX_push() < 0) {
+ if (H5CX_push() < 0) {
HDfprintf(stderr, "cannot set API context\n");
exit_value = 1;
goto done;
}
api_ctx_pushed = TRUE;
- if(NULL == (f = (H5F_t *)H5I_object(fid))) {
+ if (NULL == (f = (H5F_t *)H5I_object(fid))) {
HDfprintf(stderr, "cannot obtain H5F_t pointer\n");
exit_value = 2;
goto done;
} /* end if */
/* Ignore metadata tags while using h5debug */
- if(H5AC_ignore_tags(f) < 0) {
+ if (H5AC_ignore_tags(f) < 0) {
HDfprintf(stderr, "cannot ignore metadata tags\n");
exit_value = 1;
goto done;
@@ -318,22 +314,23 @@ main(int argc, char *argv[])
*/
/* Primary data structure to dump */
- if(argc > 2)
+ if (argc > 2)
addr = (haddr_t)HDstrtoll(argv[2], NULL, 0);
/* Extra arguments for primary data structure */
HDmemset(extra, 0, sizeof(extra));
- if(argc > 3) {
+ if (argc > 3) {
/* Number of extra arguments */
extra_count = argc - 3;
/* Range check against 'extra' array size */
- if(extra_count > (int)(sizeof(extra) / sizeof(haddr_t))) {
- HDfprintf(stderr, "\nWARNING: Only using first %d extra parameters\n\n", (int)(sizeof(extra) / sizeof(haddr_t)));
+ if (extra_count > (int)(sizeof(extra) / sizeof(haddr_t))) {
+ HDfprintf(stderr, "\nWARNING: Only using first %d extra parameters\n\n",
+ (int)(sizeof(extra) / sizeof(haddr_t)));
extra_count = (int)(sizeof(extra) / sizeof(haddr_t));
} /* end if */
- for(u = 0; u < (size_t)extra_count; u++)
+ for (u = 0; u < (size_t)extra_count; u++)
extra[u] = (haddr_t)HDstrtoll(argv[u + 3], NULL, 0);
} /* end if */
@@ -341,47 +338,45 @@ main(int argc, char *argv[])
* Read the signature at the specified file position.
*/
HDfprintf(stdout, "Reading signature at address %a (rel)\n", addr);
- if(H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), sig) < 0) {
+ if (H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), sig) < 0) {
HDfprintf(stderr, "cannot read signature\n");
exit_value = 3;
goto done;
}
- if(!HDmemcmp(sig, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) {
+ if (!HDmemcmp(sig, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) {
/*
* Debug the file's super block.
*/
status = H5F_debug(f, stdout, 0, VCOL);
-
- } else if(!HDmemcmp(sig, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ }
+ else if (!HDmemcmp(sig, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a local heap.
*/
status = H5HL_debug(f, addr, stdout, 0, VCOL);
-
}
- else if(!HDmemcmp (sig, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a global heap collection.
*/
status = H5HG_debug(f, addr, stdout, 0, VCOL);
-
}
- else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a symbol table node.
*/
/* Check for extra parameters */
- if(extra_count == 0 || extra[0] == 0) {
- HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n");
+ if (extra_count == 0 || extra[0] == 0) {
+ HDfprintf(stderr,
+ "\nWarning: Providing the group's local heap address will give more information\n");
HDfprintf(stderr, "Symbol table node usage:\n");
HDfprintf(stderr, "\th5debug <filename> <Symbol table node address> <address of local heap>\n\n");
} /* end if */
status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra[0]);
-
}
- else if(!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a B-tree. B-trees are debugged through the B-tree
* subclass. The subclass identifier is the byte immediately
@@ -391,79 +386,87 @@ main(int argc, char *argv[])
unsigned ndims;
uint32_t dim[H5O_LAYOUT_NDIMS];
- switch(subtype) {
- case H5B_SNODE_ID:
- /* Check for extra parameters */
- if(extra_count == 0 || extra[0] == 0) {
- HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n");
- HDfprintf(stderr, "B-tree symbol table node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <address of local heap>\n\n");
- exit_value = 4;
- goto done;
- } /* end if */
-
- status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra[0]);
- break;
-
- case H5B_CHUNK_ID:
- /* Check for extra parameters */
- if(extra_count == 0 || extra[0] == 0) {
- HDfprintf(stderr, "ERROR: Need number of dimensions of chunk in order to dump chunk B-tree node\n");
- HDfprintf(stderr, "B-tree chunked storage node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest chunk dim>...<fastest chunk dim>\n");
- exit_value = 4;
- goto done;
- } /* end if */
-
- /* Set # of dimensions */
- ndims = (unsigned)extra[0];
-
- /* Check for dimension error */
- if(ndims > 9) {
- HDfprintf(stderr, "ERROR: Only 9 dimensions support currently (fix h5debug)\n");
- HDfprintf(stderr, "B-tree chunked storage node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest chunk dim>...<fastest chunk dim>\n");
- exit_value = 4;
- goto done;
- } /* end for */
+ switch (subtype) {
+ case H5B_SNODE_ID:
+ /* Check for extra parameters */
+ if (extra_count == 0 || extra[0] == 0) {
+ HDfprintf(
+ stderr,
+ "\nWarning: Providing the group's local heap address will give more information\n");
+ HDfprintf(stderr, "B-tree symbol table node usage:\n");
+ HDfprintf(stderr,
+ "\th5debug <filename> <B-tree node address> <address of local heap>\n\n");
+ exit_value = 4;
+ goto done;
+ } /* end if */
- /* Build array of chunk dimensions */
- for(u = 0; u < ndims; u++)
- dim[u] = (uint32_t)extra[u + 1];
+ status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra[0]);
+ break;
- /* Check for dimension error */
- for(u = 0; u < ndims; u++)
- if(0 == dim[u]) {
- HDfprintf(stderr, "ERROR: Chunk dimensions should be >0\n");
+ case H5B_CHUNK_ID:
+ /* Check for extra parameters */
+ if (extra_count == 0 || extra[0] == 0) {
+ HDfprintf(
+ stderr,
+ "ERROR: Need number of dimensions of chunk in order to dump chunk B-tree node\n");
HDfprintf(stderr, "B-tree chunked storage node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest chunk dim>...<fastest chunk dim>\n");
+ HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest "
+ "chunk dim>...<fastest chunk dim>\n");
exit_value = 4;
goto done;
} /* end if */
- /* Set the last dimension (the element size) to zero */
- dim[ndims] = 0;
-
- status = H5D_btree_debug(f, addr, stdout, 0, VCOL, ndims, dim);
- break;
+ /* Set # of dimensions */
+ ndims = (unsigned)extra[0];
- case H5B_NUM_BTREE_ID:
- default:
- HDfprintf(stderr, "Unknown v1 B-tree subtype %u\n", (unsigned)(subtype));
- exit_value = 4;
- goto done;
+ /* Check for dimension error */
+ if (ndims > 9) {
+ HDfprintf(stderr, "ERROR: Only 9 dimensions support currently (fix h5debug)\n");
+ HDfprintf(stderr, "B-tree chunked storage node usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> <slowest "
+ "chunk dim>...<fastest chunk dim>\n");
+ exit_value = 4;
+ goto done;
+ } /* end for */
+
+ /* Build array of chunk dimensions */
+ for (u = 0; u < ndims; u++)
+ dim[u] = (uint32_t)extra[u + 1];
+
+ /* Check for dimension error */
+ for (u = 0; u < ndims; u++)
+ if (0 == dim[u]) {
+ HDfprintf(stderr, "ERROR: Chunk dimensions should be >0\n");
+ HDfprintf(stderr, "B-tree chunked storage node usage:\n");
+ HDfprintf(stderr, "\th5debug <filename> <B-tree node address> <# of dimensions> "
+ "<slowest chunk dim>...<fastest chunk dim>\n");
+ exit_value = 4;
+ goto done;
+ } /* end if */
+
+ /* Set the last dimension (the element size) to zero */
+ dim[ndims] = 0;
+
+ status = H5D_btree_debug(f, addr, stdout, 0, VCOL, ndims, dim);
+ break;
+
+ case H5B_NUM_BTREE_ID:
+ default:
+ HDfprintf(stderr, "Unknown v1 B-tree subtype %u\n", (unsigned)(subtype));
+ exit_value = 4;
+ goto done;
}
-
}
- else if(!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a v2 B-tree header.
- */
+ */
const H5B2_class_t *cls = get_H5B2_class(sig);
HDassert(cls);
- if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && (extra_count == 0 || extra[0] == 0)) {
- HDfprintf(stderr, "ERROR: Need v2 B-tree header address and object header address containing the layout message in order to dump header\n");
+ if ((cls == H5D_BT2 || cls == H5D_BT2_FILT) && (extra_count == 0 || extra[0] == 0)) {
+ HDfprintf(stderr, "ERROR: Need v2 B-tree header address and object header address containing the "
+ "layout message in order to dump header\n");
HDfprintf(stderr, "v2 B-tree hdr usage:\n");
HDfprintf(stderr, "\th5debug <filename> <v2 B-tree header address> <object header address>\n");
exit_value = 4;
@@ -471,9 +474,8 @@ main(int argc, char *argv[])
} /* end if */
status = H5B2__hdr_debug(f, addr, stdout, 0, VCOL, cls, (haddr_t)extra[0]);
-
}
- else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a v2 B-tree internal node.
*/
@@ -481,28 +483,35 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0 || extra[3] == 0)) {
- HDfprintf(stderr, "ERROR: Need v2 B-tree header address, the node's number of records, depth, and object header address containing the layout message in order to dump internal node\n");
- HDfprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n");
+ if ((cls == H5D_BT2 || cls == H5D_BT2_FILT) &&
+ (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0 || extra[3] == 0)) {
+ HDfprintf(stderr,
+ "ERROR: Need v2 B-tree header address, the node's number of records, depth, and object "
+ "header address containing the layout message in order to dump internal node\n");
+ HDfprintf(stderr,
+ "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n");
HDfprintf(stderr, "v2 B-tree internal node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> <number of records> <depth> <object header address>\n");
+ HDfprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> "
+ "<number of records> <depth> <object header address>\n");
exit_value = 4;
goto done;
-
}
- else if(extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) {
- HDfprintf(stderr, "ERROR: Need v2 B-tree header address and the node's number of records and depth in order to dump internal node\n");
- HDfprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n");
+ else if (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) {
+ HDfprintf(stderr, "ERROR: Need v2 B-tree header address and the node's number of records and "
+ "depth in order to dump internal node\n");
+ HDfprintf(stderr,
+ "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n");
HDfprintf(stderr, "v2 B-tree internal node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> <number of records> <depth>\n");
+ HDfprintf(stderr, "\th5debug <filename> <internal node address> <v2 B-tree header address> "
+ "<number of records> <depth>\n");
exit_value = 4;
goto done;
} /* end if */
- status = H5B2__int_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1], (unsigned)extra[2], (haddr_t)extra[3]);
-
+ status = H5B2__int_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1],
+ (unsigned)extra[2], (haddr_t)extra[3]);
}
- else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a v2 B-tree leaf node.
*/
@@ -510,118 +519,126 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0 )) {
+ if ((cls == H5D_BT2 || cls == H5D_BT2_FILT) &&
+ (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0)) {
- HDfprintf(stderr, "ERROR: Need v2 B-tree header address, number of records, and object header address containing the layout message in order to dump leaf node\n");
+ HDfprintf(stderr, "ERROR: Need v2 B-tree header address, number of records, and object header "
+ "address containing the layout message in order to dump leaf node\n");
HDfprintf(stderr, "v2 B-tree leaf node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records> <object header address>\n");
+ HDfprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number "
+ "of records> <object header address>\n");
exit_value = 4;
goto done;
-
}
- else if(extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
- HDfprintf(stderr, "ERROR: Need v2 B-tree header address and number of records in order to dump leaf node\n");
+ else if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
+ HDfprintf(
+ stderr,
+ "ERROR: Need v2 B-tree header address and number of records in order to dump leaf node\n");
HDfprintf(stderr, "v2 B-tree leaf node usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records>\n");
+ HDfprintf(
+ stderr,
+ "\th5debug <filename> <leaf node address> <v2 B-tree header address> <number of records>\n");
exit_value = 4;
goto done;
} /* end if */
- status = H5B2__leaf_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1], (haddr_t)extra[2]);
-
+ status =
+ H5B2__leaf_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1], (haddr_t)extra[2]);
}
- else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fractal heap header.
*/
status = H5HF_hdr_debug(f, addr, stdout, 0, VCOL);
-
}
- else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fractal heap direct block.
*/
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
- HDfprintf(stderr, "ERROR: Need fractal heap header address and size of direct block in order to dump direct block\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
+ HDfprintf(stderr, "ERROR: Need fractal heap header address and size of direct block in order to "
+ "dump direct block\n");
HDfprintf(stderr, "Fractal heap direct block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <direct block address> <heap header address> <size of direct block>\n");
+ HDfprintf(
+ stderr,
+ "\th5debug <filename> <direct block address> <heap header address> <size of direct block>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5HF_dblock_debug(f, addr, stdout, 0, VCOL, extra[0], (size_t)extra[1]);
-
}
- else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fractal heap indirect block.
*/
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
- HDfprintf(stderr, "ERROR: Need fractal heap header address and number of rows in order to dump indirect block\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
+ HDfprintf(stderr, "ERROR: Need fractal heap header address and number of rows in order to dump "
+ "indirect block\n");
HDfprintf(stderr, "Fractal heap indirect block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <indirect block address> <heap header address> <number of rows>\n");
+ HDfprintf(
+ stderr,
+ "\th5debug <filename> <indirect block address> <heap header address> <number of rows>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5HF_iblock_debug(f, addr, stdout, 0, VCOL, extra[0], (unsigned)extra[1]);
-
}
- else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a free space header.
*/
status = H5FS_debug(f, addr, stdout, 0, VCOL);
-
}
- else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug free space serialized sections.
*/
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
- HDfprintf(stderr, "ERROR: Need free space header address and client address in order to dump serialized sections\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
+ HDfprintf(stderr, "ERROR: Need free space header address and client address in order to dump "
+ "serialized sections\n");
HDfprintf(stderr, "Free space serialized sections usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <serialized sections address> <free space header address> <client address>\n");
+ HDfprintf(stderr, "\th5debug <filename> <serialized sections address> <free space header "
+ "address> <client address>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5FS_sects_debug(f, addr, stdout, 0, VCOL, extra[0], extra[1]);
-
}
- else if(!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug shared message master table.
*/
- status = H5SM_table_debug(f, addr, stdout, 0, VCOL, (unsigned) UFAIL, (unsigned) UFAIL);
-
+ status = H5SM_table_debug(f, addr, stdout, 0, VCOL, (unsigned)UFAIL, (unsigned)UFAIL);
}
- else if(!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug shared message list index.
*/
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0) {
+ if (extra_count == 0 || extra[0] == 0) {
HDfprintf(stderr, "ERROR: Need shared message header address in order to shared message list\n");
HDfprintf(stderr, "Shared message list usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <shared message list address> <shared message header address>\n");
+ HDfprintf(stderr,
+ "\th5debug <filename> <shared message list address> <shared message header address>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5SM_list_debug(f, addr, stdout, 0, VCOL, (haddr_t)extra[0]);
-
}
- else if(!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug an extensible aray header.
*/
@@ -629,18 +646,20 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0) {
- HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n");
+ if (extra_count == 0 || extra[0] == 0) {
+ HDfprintf(
+ stderr,
+ "ERROR: Need object header address containing the layout message in order to dump header\n");
HDfprintf(stderr, "Extensible array header block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <Extensible Array header address> <object header address>\n");
+ HDfprintf(stderr,
+ "\th5debug <filename> <Extensible Array header address> <object header address>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5EA__hdr_debug(f, addr, stdout, 0, VCOL, cls, extra[0]);
-
}
- else if(!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug an extensible aray index block.
*/
@@ -648,18 +667,20 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
- HDfprintf(stderr, "ERROR: Need extensible array header address and object header address containing the layout message in order to dump index block\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
+ HDfprintf(stderr, "ERROR: Need extensible array header address and object header address "
+ "containing the layout message in order to dump index block\n");
HDfprintf(stderr, "Extensible array index block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <index block address> <array header address> <object header address\n");
+ HDfprintf(
+ stderr,
+ "\th5debug <filename> <index block address> <array header address> <object header address\n");
exit_value = 4;
goto done;
} /* end if */
status = H5EA__iblock_debug(f, addr, stdout, 0, VCOL, cls, extra[0], extra[1]);
-
}
- else if(!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug an extensible aray super block.
*/
@@ -667,18 +688,19 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) {
- HDfprintf(stderr, "ERROR: Need extensible array header address, super block index and object header address containing the layout message in order to dump super block\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) {
+ HDfprintf(stderr, "ERROR: Need extensible array header address, super block index and object "
+ "header address containing the layout message in order to dump super block\n");
HDfprintf(stderr, "Extensible array super block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <super block address> <array header address> <super block index> <object header address>\n");
+ HDfprintf(stderr, "\th5debug <filename> <super block address> <array header address> <super "
+ "block index> <object header address>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5EA__sblock_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (unsigned)extra[1], extra[2]);
-
}
- else if(!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug an extensible aray data block.
*/
@@ -686,18 +708,20 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) {
- HDfprintf(stderr, "ERROR: Need extensible array header address, # of elements in data block and object header address containing the layout message in order to dump data block\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0 || extra[2] == 0) {
+ HDfprintf(stderr,
+ "ERROR: Need extensible array header address, # of elements in data block and object "
+ "header address containing the layout message in order to dump data block\n");
HDfprintf(stderr, "Extensible array data block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <# of elements in data block> <object header address\n");
+ HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <# of "
+ "elements in data block> <object header address\n");
exit_value = 4;
goto done;
} /* end if */
status = H5EA__dblock_debug(f, addr, stdout, 0, VCOL, cls, extra[0], (size_t)extra[1], extra[2]);
-
}
- else if(!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fixed array header.
*/
@@ -705,8 +729,10 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0) {
- HDfprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n");
+ if (extra_count == 0 || extra[0] == 0) {
+ HDfprintf(
+ stderr,
+ "ERROR: Need object header address containing the layout message in order to dump header\n");
HDfprintf(stderr, "Fixed array header block usage:\n");
HDfprintf(stderr, "\th5debug <filename> <Fixed Array header address> <object header address>\n");
exit_value = 4;
@@ -714,9 +740,8 @@ main(int argc, char *argv[])
} /* end if */
status = H5FA__hdr_debug(f, addr, stdout, 0, VCOL, cls, extra[0]);
-
}
- else if(!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fixed array data block.
*/
@@ -724,32 +749,32 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
- HDfprintf(stderr, "ERROR: Need fixed array header address and object header address containing the layout message in order to dump data block\n");
+ if (extra_count == 0 || extra[0] == 0 || extra[1] == 0) {
+ HDfprintf(stderr, "ERROR: Need fixed array header address and object header address containing "
+ "the layout message in order to dump data block\n");
HDfprintf(stderr, "fixed array data block usage:\n");
- HDfprintf(stderr, "\th5debug <filename> <data block address> <array header address> <object header address>\n");
+ HDfprintf(
+ stderr,
+ "\th5debug <filename> <data block address> <array header address> <object header address>\n");
exit_value = 4;
goto done;
} /* end if */
status = H5FA__dblock_debug(f, addr, stdout, 0, VCOL, cls, extra[0], extra[1]);
-
}
- else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ else if (!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug v2 object header (which have signatures).
*/
status = H5O_debug(f, addr, stdout, 0, VCOL);
-
}
- else if(sig[0] == H5O_VERSION_1) {
+ else if (sig[0] == H5O_VERSION_1) {
/*
* This could be a v1 object header. Since they don't have a signature
* it's a somewhat "ify" detection.
*/
status = H5O_debug(f, addr, stdout, 0, VCOL);
-
}
else {
/*
@@ -774,7 +799,7 @@ main(int argc, char *argv[])
} /* end else */
/* Check for an error when dumping information */
- if(status < 0) {
+ if (status < 0) {
HDfprintf(stderr, "An error occurred!\n");
H5Eprint2(H5E_DEFAULT, stderr);
exit_value = 5;
@@ -782,14 +807,16 @@ main(int argc, char *argv[])
} /* end if */
done:
- if(fapl > 0) H5Pclose(fapl);
- if(fid > 0) H5Fclose(fid);
+ if (fapl > 0)
+ H5Pclose(fapl);
+ if (fid > 0)
+ H5Fclose(fid);
/* Pop API context */
- if(api_ctx_pushed) H5CX_pop();
+ if (api_ctx_pushed)
+ H5CX_pop();
H5Eset_auto2(H5E_DEFAULT, func, edata);
return exit_value;
} /* main() */
-
diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c
index 2046373..c70b334 100644
--- a/tools/src/misc/h5mkgrp.c
+++ b/tools/src/misc/h5mkgrp.c
@@ -11,7 +11,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
#include "H5private.h"
#include "h5tools.h"
#include "h5tools_utils.h"
@@ -23,30 +22,24 @@
int d_status = EXIT_SUCCESS;
/* command-line options: short and long-named parameters */
-static const char *s_opts = "hlpvV";
-static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "latest", no_arg, 'l' },
- { "parents", no_arg, 'p' },
- { "verbose", no_arg, 'v' },
- { "version", no_arg, 'V' },
- { NULL, 0, '\0' }
-};
+static const char * s_opts = "hlpvV";
+static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"latest", no_arg, 'l'},
+ {"parents", no_arg, 'p'}, {"verbose", no_arg, 'v'},
+ {"version", no_arg, 'V'}, {NULL, 0, '\0'}};
/* Command line parameter settings */
typedef struct mkgrp_opt_t {
- char *fname; /* File name to operate on */
- hbool_t latest; /* Whether file should use latest format versions */
- hbool_t verbose; /* Whether output should be verbose */
- hbool_t parents; /* Whether to create intermediate groups */
- size_t ngroups; /* Number of groups to create */
- char **groups; /* Pointer to array of group names */
- hid_t fapl_id; /* fapl to use when opening the file */
+ char * fname; /* File name to operate on */
+ hbool_t latest; /* Whether file should use latest format versions */
+ hbool_t verbose; /* Whether output should be verbose */
+ hbool_t parents; /* Whether to create intermediate groups */
+ size_t ngroups; /* Number of groups to create */
+ char ** groups; /* Pointer to array of group names */
+ hid_t fapl_id; /* fapl to use when opening the file */
} mkgrp_opt_t;
-mkgrp_opt_t params_g; /* Command line parameter settings */
+mkgrp_opt_t params_g; /* Command line parameter settings */
-
/*-------------------------------------------------------------------------
* Function: leave
*
@@ -78,7 +71,6 @@ leave(int ret)
HDexit(ret);
} /* end leave() */
-
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -97,14 +89,15 @@ usage(const char *prog)
PRINTSTREAM(rawoutstream, "usage: %s [OPTIONS] FILE GROUP...\n", prog);
PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n");
- PRINTVALSTREAM(rawoutstream, " -l, --latest Use latest version of file format to create groups\n");
- PRINTVALSTREAM(rawoutstream, " -p, --parents No error if existing, make parent groups as needed\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -l, --latest Use latest version of file format to create groups\n");
+ PRINTVALSTREAM(rawoutstream,
+ " -p, --parents No error if existing, make parent groups as needed\n");
PRINTVALSTREAM(rawoutstream, " -v, --verbose Print information about OBJECTS and OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, "\n");
} /* end usage() */
-
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -121,18 +114,18 @@ usage(const char *prog)
static int
parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
{
- int opt; /* Option from command line */
- size_t curr_group; /* Current group name to copy */
+ int opt; /* Option from command line */
+ size_t curr_group; /* Current group name to copy */
/* Check for empty command line */
- if(argc == 1) {
+ if (argc == 1) {
usage(h5tools_getprogname());
leave(EXIT_SUCCESS);
}
/* Parse command line options */
- while((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch((char)opt) {
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char)opt) {
/* Display 'help' */
case 'h':
usage(h5tools_getprogname());
@@ -165,10 +158,10 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
usage(h5tools_getprogname());
leave(EXIT_FAILURE);
} /* end switch */
- } /* end while */
+ } /* end while */
/* Check for file name to be processed */
- if(argc <= opt_ind) {
+ if (argc <= opt_ind) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
leave(EXIT_FAILURE);
@@ -179,7 +172,7 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
opt_ind++;
/* Check for group(s) to be created */
- if(argc <= opt_ind) {
+ if (argc <= opt_ind) {
error_msg("missing group name(s)\n");
usage(h5tools_getprogname());
leave(EXIT_FAILURE);
@@ -187,11 +180,11 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
/* Allocate space for the group name pointers */
options->ngroups = (size_t)(argc - opt_ind);
- options->groups = (char **)HDmalloc(options->ngroups * sizeof(char *));
+ options->groups = (char **)HDmalloc(options->ngroups * sizeof(char *));
/* Retrieve the group names */
curr_group = 0;
- while(opt_ind < argc) {
+ while (opt_ind < argc) {
options->groups[curr_group] = HDstrdup(argv[opt_ind]);
curr_group++;
opt_ind++;
@@ -200,7 +193,6 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
return 0;
} /* parse_command_line() */
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -213,9 +205,9 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
int
main(int argc, const char *argv[])
{
- hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
- hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list ID */
- size_t curr_group; /* Current group to create */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list ID */
+ size_t curr_group; /* Current group to create */
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -227,13 +219,13 @@ main(int argc, const char *argv[])
HDmemset(&params_g, 0, sizeof(params_g));
/* Create file access property list */
- if((params_g.fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ if ((params_g.fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
error_msg("Could not create file access property list\n");
leave(EXIT_FAILURE);
}
/* Parse command line */
- if(parse_command_line(argc, argv, &params_g) < 0) {
+ if (parse_command_line(argc, argv, &params_g) < 0) {
error_msg("unable to parse command line arguments\n");
leave(EXIT_FAILURE);
}
@@ -242,15 +234,15 @@ main(int argc, const char *argv[])
h5tools_error_report();
/* Check for creating groups with new format version */
- if(params_g.latest) {
+ if (params_g.latest) {
/* Set the "use the latest version of the format" bounds */
- if(H5Pset_libver_bounds(params_g.fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ if (H5Pset_libver_bounds(params_g.fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
error_msg("Could not set property for using latest version of the format\n");
leave(EXIT_FAILURE);
}
/* Display some output if requested */
- if(params_g.verbose)
+ if (params_g.verbose)
HDprintf("%s: Creating groups with latest version of the format\n", h5tools_getprogname());
}
@@ -259,67 +251,66 @@ main(int argc, const char *argv[])
/* If we couldn't open an existing file, try creating file */
/* (use "EXCL" instead of "TRUNC", so we don't blow away existing non-HDF5 file) */
- if(fid < 0)
+ if (fid < 0)
fid = H5Fcreate(params_g.fname, H5F_ACC_EXCL, H5P_DEFAULT, params_g.fapl_id);
/* Test for error in opening file */
- if(fid < 0) {
+ if (fid < 0) {
error_msg("Could not open output file '%s'\n", params_g.fname);
leave(EXIT_FAILURE);
}
/* Create link creation property list */
- if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
+ if ((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
error_msg("Could not create link creation property list\n");
leave(EXIT_FAILURE);
}
/* Check for creating intermediate groups */
- if(params_g.parents) {
+ if (params_g.parents) {
/* Set the intermediate group creation property */
- if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) {
+ if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) {
error_msg("Could not set property for creating parent groups\n");
leave(EXIT_FAILURE);
}
/* Display some output if requested */
- if(params_g.verbose)
+ if (params_g.verbose)
HDprintf("%s: Creating parent groups\n", h5tools_getprogname());
}
/* Loop over creating requested groups */
- for(curr_group = 0; curr_group < params_g.ngroups; curr_group++) {
- hid_t gid; /* Group ID */
+ for (curr_group = 0; curr_group < params_g.ngroups; curr_group++) {
+ hid_t gid; /* Group ID */
/* Attempt to create a group */
- if((gid = H5Gcreate2(fid, params_g.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ if ((gid = H5Gcreate2(fid, params_g.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
error_msg("Could not create group '%s'\n", params_g.groups[curr_group]);
leave(EXIT_FAILURE);
}
/* Close the group */
- if(H5Gclose(gid) < 0) {
+ if (H5Gclose(gid) < 0) {
error_msg("Could not close group '%s'??\n", params_g.groups[curr_group]);
leave(EXIT_FAILURE);
}
/* Display some output if requested */
- if(params_g.verbose)
+ if (params_g.verbose)
HDprintf("%s: created group '%s'\n", h5tools_getprogname(), params_g.groups[curr_group]);
} /* end for */
/* Close link creation property list */
- if(H5Pclose(lcpl_id) < 0) {
+ if (H5Pclose(lcpl_id) < 0) {
error_msg("Could not close link creation property list\n");
leave(EXIT_FAILURE);
}
/* Close file */
- if(H5Fclose(fid) < 0) {
+ if (H5Fclose(fid) < 0) {
error_msg("Could not close output file '%s'??\n", params_g.fname);
leave(EXIT_FAILURE);
}
leave(EXIT_SUCCESS);
} /* end main() */
-
diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c
index 371cf2c..6424384 100644
--- a/tools/src/misc/h5repart.c
+++ b/tools/src/misc/h5repart.c
@@ -26,16 +26,15 @@
#include "hdf5.h"
#include "H5private.h"
-#define NAMELEN 4096
-#define GB *1024*1024*1024
+#define NAMELEN 4096
+#define GB *1024 * 1024 * 1024
/* Make these 2 private properties(defined in H5Fprivate.h) available to h5repart.
* The first one updates the member file size in the superblock. The second one
* change file driver from family to a single file driver.
*/
-#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize"
-#define H5F_ACS_FAMILY_TO_SINGLE_NAME "family_to_single"
-
+#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize"
+#define H5F_ACS_FAMILY_TO_SINGLE_NAME "family_to_single"
/*-------------------------------------------------------------------------
* Function: usage
@@ -52,26 +51,26 @@
*-------------------------------------------------------------------------
*/
static void
-usage (const char *progname)
+usage(const char *progname)
{
HDfprintf(stderr, "usage: %s [-v] [-V] [-[b|m] N[g|m|k]] [-family_to_sec2|-family_to_single] SRC DST\n",
- progname);
+ progname);
HDfprintf(stderr, " -v Produce verbose output\n");
HDfprintf(stderr, " -V Print a version number and exit\n");
HDfprintf(stderr, " -b N The I/O block size, defaults to 1kB\n");
HDfprintf(stderr, " -m N The destination member size or 1GB\n");
HDfprintf(stderr, " -family_to_sec2 Deprecated version of -family_to_single (below)\n");
- HDfprintf(stderr, " -family_to_single Change file driver from family to the default single-file VFD (windows or sec2)\n");
+ HDfprintf(stderr, " -family_to_single Change file driver from family to the default single-file VFD "
+ "(windows or sec2)\n");
HDfprintf(stderr, " SRC The name of the source file\n");
HDfprintf(stderr, " DST The name of the destination files\n");
HDfprintf(stderr, "Sizes may be suffixed with `g' for GB, `m' for MB or "
- "`k' for kB.\n");
+ "`k' for kB.\n");
HDfprintf(stderr, "File family names include an integer printf "
- "format such as `%%d'\n");
- HDexit (EXIT_FAILURE);
+ "format such as `%%d'\n");
+ HDexit(EXIT_FAILURE);
}
-
/*-------------------------------------------------------------------------
* Function: get_size
*
@@ -95,48 +94,47 @@ usage (const char *progname)
*-------------------------------------------------------------------------
*/
static off_t
-get_size (const char *progname, int *argno, int argc, char *argv[])
+get_size(const char *progname, int *argno, int argc, char *argv[])
{
- off_t retval=-1;
- char *suffix;
+ off_t retval = -1;
+ char *suffix;
- if (isdigit ((int)(argv[*argno][2]))) {
- retval = HDstrtol(argv[*argno]+2, &suffix, 10);
+ if (isdigit((int)(argv[*argno][2]))) {
+ retval = HDstrtol(argv[*argno] + 2, &suffix, 10);
(*argno)++;
}
- else if (argv[*argno][2] || *argno+1>=argc) {
- usage (progname);
+ else if (argv[*argno][2] || *argno + 1 >= argc) {
+ usage(progname);
}
else {
- retval = HDstrtol(argv[*argno+1], &suffix, 0);
- if (suffix == argv[*argno+1])
- usage (progname);
+ retval = HDstrtol(argv[*argno + 1], &suffix, 0);
+ if (suffix == argv[*argno + 1])
+ usage(progname);
*argno += 2;
}
if (suffix && suffix[0] && !suffix[1]) {
switch (*suffix) {
- case 'G':
- case 'g':
- retval *= 1024 * 1024 * 1024;
- break;
- case 'M':
- case 'm':
- retval *= 1024 * 1024;
- break;
- case 'k':
- retval *= 1024;
- break;
- default:
- usage(progname);
+ case 'G':
+ case 'g':
+ retval *= 1024 * 1024 * 1024;
+ break;
+ case 'M':
+ case 'm':
+ retval *= 1024 * 1024;
+ break;
+ case 'k':
+ retval *= 1024;
+ break;
+ default:
+ usage(progname);
}
}
else if (suffix && suffix[0]) {
- usage (progname);
+ usage(progname);
}
return retval;
}
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -154,47 +152,47 @@ get_size (const char *progname, int *argno, int argc, char *argv[])
*-------------------------------------------------------------------------
*/
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
- const char *prog_name; /*program name */
- size_t blk_size=1024; /*size of each I/O block */
- char *buf=NULL; /*I/O block buffer */
- size_t n, i; /*counters */
- ssize_t nio; /*I/O return value */
- int argno=1; /*program argument number */
- int src, dst=-1; /*source & destination files */
- int need_seek=FALSE; /*destination needs to seek? */
- int need_write; /*data needs to be written? */
- h5_stat_t sb; /*temporary file stat buffer */
-
- int verbose=FALSE; /*display file names? */
-
- const char *src_gen_name; /*general source name */
- char *src_name=NULL; /*source member name */
-
- int src_is_family; /*is source name a family name? */
- int src_membno=0; /*source member number */
-
- const char *dst_gen_name; /*general destination name */
- char *dst_name=NULL; /*destination member name */
- int dst_is_family; /*is dst name a family name? */
- int dst_membno=0; /*destination member number */
-
- off_t left_overs=0; /*amount of zeros left over */
- off_t src_offset=0; /*offset in source member */
- off_t dst_offset=0; /*offset in destination member */
- off_t src_size; /*source logical member size */
- off_t src_act_size; /*source actual member size */
- off_t dst_size=1 GB; /*destination logical memb size */
- hid_t fapl; /*file access property list */
- hid_t file;
- hsize_t hdsize; /*destination logical memb size */
- hbool_t family_to_single = FALSE; /*change family to single file driver? */
+ const char *prog_name; /*program name */
+ size_t blk_size = 1024; /*size of each I/O block */
+ char * buf = NULL; /*I/O block buffer */
+ size_t n, i; /*counters */
+ ssize_t nio; /*I/O return value */
+ int argno = 1; /*program argument number */
+ int src, dst = -1; /*source & destination files */
+ int need_seek = FALSE; /*destination needs to seek? */
+ int need_write; /*data needs to be written? */
+ h5_stat_t sb; /*temporary file stat buffer */
+
+ int verbose = FALSE; /*display file names? */
+
+ const char *src_gen_name; /*general source name */
+ char * src_name = NULL; /*source member name */
+
+ int src_is_family; /*is source name a family name? */
+ int src_membno = 0; /*source member number */
+
+ const char *dst_gen_name; /*general destination name */
+ char * dst_name = NULL; /*destination member name */
+ int dst_is_family; /*is dst name a family name? */
+ int dst_membno = 0; /*destination member number */
+
+ off_t left_overs = 0; /*amount of zeros left over */
+ off_t src_offset = 0; /*offset in source member */
+ off_t dst_offset = 0; /*offset in destination member */
+ off_t src_size; /*source logical member size */
+ off_t src_act_size; /*source actual member size */
+ off_t dst_size = 1 GB; /*destination logical memb size */
+ hid_t fapl; /*file access property list */
+ hid_t file;
+ hsize_t hdsize; /*destination logical memb size */
+ hbool_t family_to_single = FALSE; /*change family to single file driver? */
/*
* Get the program name from argv[0]. Use only the last component.
*/
- if ((prog_name = HDstrrchr (argv[0], '/')))
+ if ((prog_name = HDstrrchr(argv[0], '/')))
prog_name++;
else
prog_name = argv[0];
@@ -206,28 +204,35 @@ main (int argc, char *argv[])
if (!HDstrcmp(argv[argno], "-v")) {
verbose = TRUE;
argno++;
- } else if (!HDstrcmp(argv[argno], "-V")) {
- HDprintf("This is %s version %u.%u release %u\n", prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
+ }
+ else if (!HDstrcmp(argv[argno], "-V")) {
+ HDprintf("This is %s version %u.%u release %u\n", prog_name, H5_VERS_MAJOR, H5_VERS_MINOR,
+ H5_VERS_RELEASE);
HDexit(EXIT_SUCCESS);
- } else if (!HDstrcmp(argv[argno], "-family_to_sec2")) {
+ }
+ else if (!HDstrcmp(argv[argno], "-family_to_sec2")) {
family_to_single = TRUE;
argno++;
- } else if (!HDstrcmp(argv[argno], "-family_to_single")) {
+ }
+ else if (!HDstrcmp(argv[argno], "-family_to_single")) {
family_to_single = TRUE;
argno++;
- } else if ('b' == argv[argno][1]) {
- blk_size = (size_t) get_size(prog_name, &argno, argc, argv);
- } else if ('m' == argv[argno][1]) {
+ }
+ else if ('b' == argv[argno][1]) {
+ blk_size = (size_t)get_size(prog_name, &argno, argc, argv);
+ }
+ else if ('m' == argv[argno][1]) {
dst_size = get_size(prog_name, &argno, argc, argv);
- } else {
+ }
+ else {
usage(prog_name);
} /* end if */
- } /* end while */
+ } /* end while */
/* allocate names */
- if(NULL == (src_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char))))
+ if (NULL == (src_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char))))
HDexit(EXIT_FAILURE);
- if(NULL == (dst_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char))))
+ if (NULL == (dst_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char))))
HDexit(EXIT_FAILURE);
/*
@@ -238,7 +243,7 @@ main (int argc, char *argv[])
usage(prog_name);
src_gen_name = argv[argno++];
HDsprintf(src_name, src_gen_name, src_membno);
- src_is_family = strcmp (src_name, src_gen_name);
+ src_is_family = strcmp(src_name, src_gen_name);
if ((src = HDopen(src_name, O_RDONLY)) < 0) {
HDperror(src_name);
@@ -256,13 +261,13 @@ main (int argc, char *argv[])
/*
* Get the name for the destination file and open the first member.
*/
- if (argno>=argc)
- usage (prog_name);
+ if (argno >= argc)
+ usage(prog_name);
dst_gen_name = argv[argno++];
HDsprintf(dst_name, dst_gen_name, dst_membno);
dst_is_family = HDstrcmp(dst_name, dst_gen_name);
- if ((dst = HDopen(dst_name, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) {
+ if ((dst = HDopen(dst_name, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) {
HDperror(dst_name);
HDexit(EXIT_FAILURE);
}
@@ -271,32 +276,32 @@ main (int argc, char *argv[])
/* No more arguments */
if (argno < argc)
- usage (prog_name);
+ usage(prog_name);
/* Now the real work, split the file */
buf = (char *)HDmalloc(blk_size);
- while (src_offset<src_size) {
+ while (src_offset < src_size) {
- /* Read a block. The amount to read is the minimum of:
- * 1. The I/O block size
- * 2. What's left to write in the destination member
- * 3. Left over zeros or what's left in the source member.
- */
+ /* Read a block. The amount to read is the minimum of:
+ * 1. The I/O block size
+ * 2. What's left to write in the destination member
+ * 3. Left over zeros or what's left in the source member.
+ */
n = blk_size;
if (dst_is_family)
- n = (size_t)MIN((off_t)n, dst_size-dst_offset);
+ n = (size_t)MIN((off_t)n, dst_size - dst_offset);
if (left_overs) {
- n = (size_t)MIN((off_t)n, left_overs);
- left_overs = left_overs - (off_t) n;
+ n = (size_t)MIN((off_t)n, left_overs);
+ left_overs = left_overs - (off_t)n;
need_write = FALSE;
}
else if (src_offset < src_act_size) {
- n = (size_t)MIN((off_t)n, src_act_size-src_offset);
+ n = (size_t)MIN((off_t)n, src_act_size - src_offset);
if ((nio = HDread(src, buf, n)) < 0) {
HDperror("read");
HDexit(EXIT_FAILURE);
}
- else if ((size_t) nio != n) {
+ else if ((size_t)nio != n) {
HDfprintf(stderr, "%s: short read\n", src_name);
HDexit(EXIT_FAILURE);
}
@@ -307,18 +312,18 @@ main (int argc, char *argv[])
need_write = (i < n);
}
else {
- n = 0;
+ n = 0;
left_overs = src_size - src_act_size;
need_write = FALSE;
}
- /*
- * If the block contains non-zero data then write it to the
- * destination, otherwise just remember that we'll have to do a seek
- * later in the destination when we finally get non-zero data.
- */
+ /*
+ * If the block contains non-zero data then write it to the
+ * destination, otherwise just remember that we'll have to do a seek
+ * later in the destination when we finally get non-zero data.
+ */
if (need_write) {
- if (need_seek && HDlseek (dst, dst_offset, SEEK_SET) < 0) {
+ if (need_seek && HDlseek(dst, dst_offset, SEEK_SET) < 0) {
HDperror("HDlseek");
HDexit(EXIT_FAILURE);
}
@@ -326,7 +331,7 @@ main (int argc, char *argv[])
HDperror("write");
HDexit(EXIT_FAILURE);
}
- else if ((size_t) nio != n) {
+ else if ((size_t)nio != n) {
HDfprintf(stderr, "%s: short write\n", dst_name);
HDexit(EXIT_FAILURE);
}
@@ -336,64 +341,64 @@ main (int argc, char *argv[])
need_seek = TRUE;
}
- /*
- * Update the source offset and open the next source family member if
- * necessary. The source stream ends at the first member which
- * cannot be opened because it doesn't exist. At the end of the
- * source stream, update the destination offset and break out of the
- * loop. The destination offset must be updated so we can fix
- * trailing holes.
- */
- src_offset = src_offset + (off_t) n;
+ /*
+ * Update the source offset and open the next source family member if
+ * necessary. The source stream ends at the first member which
+ * cannot be opened because it doesn't exist. At the end of the
+ * source stream, update the destination offset and break out of the
+ * loop. The destination offset must be updated so we can fix
+ * trailing holes.
+ */
+ src_offset = src_offset + (off_t)n;
if (src_offset == src_act_size) {
HDclose(src);
if (!src_is_family) {
- dst_offset = dst_offset + (off_t) n;
+ dst_offset = dst_offset + (off_t)n;
break;
}
HDsprintf(src_name, src_gen_name, ++src_membno);
if ((src = HDopen(src_name, O_RDONLY)) < 0 && ENOENT == errno) {
- dst_offset = dst_offset + (off_t) n;
+ dst_offset = dst_offset + (off_t)n;
break;
}
else if (src < 0) {
HDperror(src_name);
HDexit(EXIT_FAILURE);
}
- if (HDfstat (src, &sb) < 0) {
+ if (HDfstat(src, &sb) < 0) {
HDperror("fstat");
HDexit(EXIT_FAILURE);
}
src_act_size = sb.st_size;
if (src_act_size > src_size) {
- HDfprintf(stderr, "%s: member truncated to %lu bytes\n", src_name, (unsigned long) src_size);
+ HDfprintf(stderr, "%s: member truncated to %lu bytes\n", src_name, (unsigned long)src_size);
}
src_offset = 0;
if (verbose)
HDfprintf(stderr, "< %s\n", src_name);
}
- /*
- * Update the destination offset, opening a new member if one will be
- * needed. The first member is extended to the logical member size
- * but other members might be smaller if they end with a hole.
- */
- dst_offset = dst_offset + (off_t) n;
+ /*
+ * Update the destination offset, opening a new member if one will be
+ * needed. The first member is extended to the logical member size
+ * but other members might be smaller if they end with a hole.
+ */
+ dst_offset = dst_offset + (off_t)n;
if (dst_is_family && dst_offset == dst_size) {
if (0 == dst_membno) {
- if (HDlseek (dst, dst_size-1, SEEK_SET) < 0) {
+ if (HDlseek(dst, dst_size - 1, SEEK_SET) < 0) {
HDperror("HDHDlseek");
HDexit(EXIT_FAILURE);
}
- if (HDread (dst, buf, 1) < 0) {
+ if (HDread(dst, buf, 1) < 0) {
HDperror("read");
HDexit(EXIT_FAILURE);
}
- if (HDlseek (dst, dst_size-1, SEEK_SET) < 0) {
+ if (HDlseek(dst, dst_size - 1, SEEK_SET) < 0) {
HDperror("HDlseek");
HDexit(EXIT_FAILURE);
}
- if (HDwrite (dst, buf, 1) < 0) {
+ if (HDwrite(dst, buf, 1) < 0) {
HDperror("write");
HDexit(EXIT_FAILURE);
}
@@ -405,7 +410,7 @@ main (int argc, char *argv[])
HDexit(EXIT_FAILURE);
}
dst_offset = 0;
- need_seek = FALSE;
+ need_seek = FALSE;
if (verbose)
HDfprintf(stderr, "> %s\n", dst_name);
}
@@ -417,56 +422,56 @@ main (int argc, char *argv[])
* family has been truncated.
*/
if (need_seek) {
- if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) {
- HDperror ("HDlseek");
- HDexit (EXIT_FAILURE);
+ if (HDlseek(dst, dst_offset - 1, SEEK_SET) < 0) {
+ HDperror("HDlseek");
+ HDexit(EXIT_FAILURE);
}
- if (HDread (dst, buf, 1)<0) {
- HDperror ("read");
- HDexit (EXIT_FAILURE);
+ if (HDread(dst, buf, 1) < 0) {
+ HDperror("read");
+ HDexit(EXIT_FAILURE);
}
- if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) {
- HDperror ("HDlseek");
- HDexit (EXIT_FAILURE);
+ if (HDlseek(dst, dst_offset - 1, SEEK_SET) < 0) {
+ HDperror("HDlseek");
+ HDexit(EXIT_FAILURE);
}
- if (HDwrite (dst, buf, 1)<0) {
- HDperror ("write");
- HDexit (EXIT_FAILURE);
+ if (HDwrite(dst, buf, 1) < 0) {
+ HDperror("write");
+ HDexit(EXIT_FAILURE);
}
}
- HDclose (dst);
+ HDclose(dst);
/* Modify family driver information saved in superblock through private property.
* These private properties are for this tool only. */
- if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) {
- HDperror ("H5Pcreate");
- HDexit (EXIT_FAILURE);
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ HDperror("H5Pcreate");
+ HDexit(EXIT_FAILURE);
}
- if(family_to_single) {
+ if (family_to_single) {
/* The user wants to change file driver from family to a single-file VFD.
* Open the file with the sec2, windows, etc. driver. This property signals
* the library to ignore the family driver information saved in the superblock.
*/
- if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SINGLE_NAME, &family_to_single) < 0) {
- HDperror ("H5Pset");
- HDexit (EXIT_FAILURE);
+ if (H5Pset(fapl, H5F_ACS_FAMILY_TO_SINGLE_NAME, &family_to_single) < 0) {
+ HDperror("H5Pset");
+ HDexit(EXIT_FAILURE);
}
}
else {
/* Modify family size saved in superblock through private property. It signals
* library to save the new member size(specified in command line) in superblock.
* This private property is for this tool only. */
- if(H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) {
- HDperror ("H5Pset_fapl_family");
- HDexit (EXIT_FAILURE);
+ if (H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) {
+ HDperror("H5Pset_fapl_family");
+ HDexit(EXIT_FAILURE);
}
/* Set the property of the new member size as hsize_t */
hdsize = (hsize_t)dst_size;
- if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) {
- HDperror ("H5Pset");
- HDexit (EXIT_FAILURE);
+ if (H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) {
+ HDperror("H5Pset");
+ HDexit(EXIT_FAILURE);
}
}
@@ -478,18 +483,17 @@ main (int argc, char *argv[])
* file and the new file can only be a single file, reopen the new file should fail.
* There's nothing to do in this case.
*/
- H5E_BEGIN_TRY {
- file = H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { file = H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl); }
+ H5E_END_TRY;
- if(file >= 0) {
- if(H5Fclose(file) < 0) {
+ if (file >= 0) {
+ if (H5Fclose(file) < 0) {
HDperror("H5Fclose");
HDexit(EXIT_FAILURE);
} /* end if */
- } /* end if */
+ } /* end if */
- if(H5Pclose(fapl) < 0) {
+ if (H5Pclose(fapl) < 0) {
HDperror("H5Pclose");
HDexit(EXIT_FAILURE);
} /* end if */