summaryrefslogtreecommitdiffstats
path: root/tools/h5diff
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-10-01 16:47:45 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-10-01 16:47:45 (GMT)
commit1ba1f2f3222cbe8df0bf601929a4bffd478d7e02 (patch)
treeae51dfc33cf40432dad25a5088767115a98f195e /tools/h5diff
parent8eef7d295cc3dd134aef0a826f1de4287629996d (diff)
downloadhdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.zip
hdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.tar.gz
hdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.tar.bz2
Source formatted
Diffstat (limited to 'tools/h5diff')
-rw-r--r--tools/h5diff/dynlib_diff.c54
-rw-r--r--tools/h5diff/h5diff_common.c714
-rw-r--r--tools/h5diff/h5diff_common.h5
-rw-r--r--tools/h5diff/h5diff_main.c50
-rw-r--r--tools/h5diff/h5diffgentest.c3568
-rw-r--r--tools/h5diff/ph5diff_main.c120
6 files changed, 2263 insertions, 2248 deletions
diff --git a/tools/h5diff/dynlib_diff.c b/tools/h5diff/dynlib_diff.c
index 661a6dc..32d2daf 100644
--- a/tools/h5diff/dynlib_diff.c
+++ b/tools/h5diff/dynlib_diff.c
@@ -17,25 +17,33 @@
#include <stdio.h>
#include "H5PLextern.h"
-#define H5Z_FILTER_DYNLIBUD 300
-#define MULTIPLIER 3
+#define H5Z_FILTER_DYNLIBUD 300
+#define MULTIPLIER 3
-static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
+ size_t nbytes, size_t *buf_size, void **buf);
/* This message derives from H5Z */
const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
H5Z_FILTER_DYNLIBUD, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
- "dynlibud", /* Filter name for debugging */
+ "dynlibud", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
- (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
+ (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
}};
-H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
-const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
+H5PL_type_t
+H5PLget_plugin_type(void)
+{
+ return H5PL_TYPE_FILTER;
+}
+const void *
+H5PLget_plugin_info(void)
+{
+ return H5Z_DYNLIBUD;
+}
/*-------------------------------------------------------------------------
* Function: H5Z_filter_dynlibud
@@ -51,39 +59,37 @@ const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
*-------------------------------------------------------------------------
*/
static size_t
-H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
- const unsigned int *cd_values, size_t nbytes,
- size_t *buf_size, void **buf)
+H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
{
- char *int_ptr = (char *)*buf; /* Pointer to the data values */
- size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ char * int_ptr = (char *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
/* Check for the correct number of parameters */
- if(cd_nelmts > 0)
- return(0);
+ if (cd_nelmts > 0)
+ return (0);
/* Assignment to eliminate unused parameter warning. */
cd_values = cd_values;
- if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ if (flags & H5Z_FLAG_REVERSE) { /*read*/
/* Subtract the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp - MULTIPLIER);
+ *int_ptr = (int8_t)(temp - MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
- } /* end while */
- } /* end if */
+ } /* end while */
+ } /* end if */
else { /*write*/
/* Add the original value with MULTIPLIER */
- while(buf_left > 0) {
+ while (buf_left > 0) {
char temp = *int_ptr;
- *int_ptr = (int8_t)(temp + MULTIPLIER);
+ *int_ptr = (int8_t)(temp + MULTIPLIER);
int_ptr++;
buf_left -= sizeof(*int_ptr);
} /* end while */
- } /* end else */
+ } /* end else */
return nbytes;
} /* end H5Z_filter_dynlibud() */
-
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c
index 90f0f7b..76dd6fa 100644
--- a/tools/h5diff/h5diff_common.c
+++ b/tools/h5diff/h5diff_common.c
@@ -17,33 +17,31 @@
#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: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' },
- { "enable-error-stack", no_arg, 'S' },
- { NULL, 0, '\0' }
-};
+static const char * s_opts = "hVrv:qn:d:p:NcelxE: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'},
+ {"enable-error-stack", no_arg, 'S'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: check_options
@@ -52,7 +50,8 @@ static struct long_options l_opts[] = {
*
*-------------------------------------------------------------------------
*/
-static void check_options(diff_opt_t* opts)
+static void
+check_options(diff_opt_t *opts)
{
/*--------------------------------------------------------------
* check for mutually exclusive options
@@ -64,12 +63,13 @@ static void check_options(diff_opt_t* opts)
if ((opts->d + opts->p + 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);
}
}
-
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -78,20 +78,16 @@ static void check_options(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
+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;
/* process the command-line */
- memset(opts, 0, sizeof (diff_opt_t));
+ memset(opts, 0, sizeof(diff_opt_t));
/* assume equal contents initially */
opts->contents = 1;
@@ -104,7 +100,7 @@ void parse_command_line(int argc,
/* initially no not-comparable. */
/**this is bad in mixing option with results**/
- opts->not_cmp=0;
+ opts->not_cmp = 0;
/* init for exclude-path option */
exclude_head = NULL;
@@ -112,152 +108,153 @@ void parse_command_line(int argc,
/* 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->m_verbose = 1;
- /* This for loop is for handling style like
- * -v, -v1, --verbose, --verbose=1.
- */
- for (i = 1; i < argc; i++) {
- /*
- * short opt
- */
- if (!strcmp (argv[i], "-v")) { /* no arg */
- opt_ind--;
- opts->m_verbose_level = 0;
- break;
- }
- else if (!strncmp (argv[i], "-v", (size_t)2)) {
- opts->m_verbose_level = atoi(&argv[i][2]);
- break;
- }
+ default:
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ break;
- /*
- * long opt
+ case 'h':
+ usage();
+ h5diff_exit(EXIT_SUCCESS);
+ break;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ h5diff_exit(EXIT_SUCCESS);
+ break;
+
+ case 'v':
+ opts->m_verbose = 1;
+ /* This for loop is for handling style like
+ * -v, -v1, --verbose, --verbose=1.
*/
- if (!strcmp (argv[i], "--verbose")) { /* no arg */
- opts->m_verbose_level = 0;
- break;
- }
- else if ( !strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=') {
- opts->m_verbose_level = atoi(&argv[i][10]);
- break;
+ for (i = 1; i < argc; i++) {
+ /*
+ * short opt
+ */
+ if (!strcmp(argv[i], "-v")) { /* no arg */
+ opt_ind--;
+ opts->m_verbose_level = 0;
+ break;
+ }
+ else if (!strncmp(argv[i], "-v", (size_t)2)) {
+ opts->m_verbose_level = atoi(&argv[i][2]);
+ break;
+ }
+
+ /*
+ * long opt
+ */
+ if (!strcmp(argv[i], "--verbose")) { /* no arg */
+ opts->m_verbose_level = 0;
+ break;
+ }
+ else if (!strncmp(argv[i], "--verbose", (size_t)9) && argv[i][9] == '=') {
+ opts->m_verbose_level = atoi(&argv[i][10]);
+ break;
+ }
}
- }
- break;
+ break;
- case 'q':
- /* use quiet mode; supress the message "0 differences found" */
- opts->m_quiet = 1;
- break;
+ case 'q':
+ /* use quiet mode; supress the message "0 differences found" */
+ opts->m_quiet = 1;
+ break;
- case 'r':
- opts->m_report = 1;
- break;
+ case 'r':
+ opts->m_report = 1;
+ break;
- case 'l':
- opts->follow_links = TRUE;
- break;
+ case 'l':
+ opts->follow_links = TRUE;
+ break;
- case 'x':
- opts->no_dangle_links = 1;
- break;
+ case 'x':
+ opts->no_dangle_links = 1;
+ break;
- case 'S':
- enable_error_stack = 1;
- break;
+ case 'S':
+ enable_error_stack = 1;
+ break;
- case 'E':
- opts->exclude_path = 1;
+ 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);
- }
-
- /* init */
- exclude_node->obj_path = (char*)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 'd':
- opts->d=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 = atof(opt_arg);
-
- /* -d 0 is the same as default */
- if (H5_DBL_ABS_EQUAL(opts->delta, (double)0.0F))
- opts->d=0;
- break;
-
- case 'p':
- opts->p=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 = atof(opt_arg);
-
- /* -p 0 is the same as default */
- if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F))
- opts->p = 0;
- break;
-
- case 'n':
- opts->n=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;
+ /* 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 = (char *)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;
- case 'N':
- opts->do_nans = 0;
- break;
+ exclude_node->next = NULL;
+ exclude_prev->next = exclude_node;
+ }
+ break;
- case 'c':
- opts->m_list_not_cmp = 1;
- break;
+ case 'd':
+ opts->d = 1;
- case 'e':
- opts->use_system_epsilon = 1;
- 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 = atof(opt_arg);
+
+ /* -d 0 is the same as default */
+ if (H5_DBL_ABS_EQUAL(opts->delta, (double)0.0F))
+ opts->d = 0;
+ break;
+
+ case 'p':
+ opts->p = 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 = atof(opt_arg);
+
+ /* -p 0 is the same as default */
+ if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F))
+ opts->p = 0;
+ break;
+
+ case 'n':
+ opts->n = 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 'c':
+ opts->m_list_not_cmp = 1;
+ break;
+
+ case 'e':
+ opts->use_system_epsilon = 1;
+ break;
}
}
@@ -269,32 +266,29 @@ void parse_command_line(int argc,
opts->exclude = exclude_head;
/* check for file names to be processed */
- if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL) {
+ if (argc <= opt_ind || argv[opt_ind + 1] == NULL) {
error_msg("missing file names\n");
usage();
h5diff_exit(EXIT_FAILURE);
}
- *fname1 = argv[ opt_ind ];
- *fname2 = argv[ opt_ind + 1 ];
- *objname1 = argv[ opt_ind + 2 ];
+ *fname1 = argv[opt_ind];
+ *fname2 = argv[opt_ind + 1];
+ *objname1 = argv[opt_ind + 2];
if (*objname1 == NULL) {
*objname2 = NULL;
return;
}
- if (argv[ opt_ind + 3 ] != NULL) {
- *objname2 = argv[ opt_ind + 3 ];
+ if (argv[opt_ind + 3] != NULL) {
+ *objname2 = argv[opt_ind + 3];
}
else {
*objname2 = *objname1;
}
-
-
}
-
/*-------------------------------------------------------------------------
* Function: print_info
*
@@ -302,7 +296,8 @@ void parse_command_line(int argc,
*
*-------------------------------------------------------------------------
*/
-void print_info(diff_opt_t* opts)
+void
+print_info(diff_opt_t *opts)
{
if (opts->m_quiet || opts->err_stat)
return;
@@ -344,10 +339,10 @@ void print_info(diff_opt_t* opts)
*-------------------------------------------------------------------------
*/
static int
-check_n_input( const char *str )
+check_n_input(const char *str)
{
unsigned i;
- char c;
+ char c;
for (i = 0; i < HDstrlen(str); i++) {
c = str[i];
@@ -355,9 +350,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;
}
@@ -378,7 +372,7 @@ check_n_input( const char *str )
*-------------------------------------------------------------------------
*/
static int
-check_p_input( const char *str )
+check_p_input(const char *str)
{
double x;
@@ -412,7 +406,7 @@ check_p_input( const char *str )
*-------------------------------------------------------------------------
*/
static int
-check_d_input( const char *str )
+check_d_input(const char *str)
{
double x;
@@ -440,155 +434,203 @@ 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\n");
- PRINTVALSTREAM(rawoutstream, " status summary.\n");
- PRINTVALSTREAM(rawoutstream, " 2 : All level 1 information plus extended attribute\n");
- PRINTVALSTREAM(rawoutstream, " status report.\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, " 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");
-
- 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\n");
+ PRINTVALSTREAM(rawoutstream, " status summary.\n");
+ PRINTVALSTREAM(rawoutstream, " 2 : All level 1 information plus extended attribute\n");
+ PRINTVALSTREAM(rawoutstream, " status report.\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, " 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");
+
+ 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/h5diff/h5diff_common.h b/tools/h5diff/h5diff_common.h
index dc0676c..b855077 100644
--- a/tools/h5diff/h5diff_common.h
+++ b/tools/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/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index c5a0cbf..64d8103 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -17,7 +17,6 @@
#include "h5tools.h"
#include "h5tools_utils.h"
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -65,20 +64,20 @@
*-------------------------------------------------------------------------
*/
-
-int main(int argc, const char *argv[])
+int
+main(int argc, const char *argv[])
{
- int ret;
- H5E_auto2_t func;
- H5E_auto2_t tools_func;
- void *edata;
- void *tools_edata;
- 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;
+ H5E_auto2_t func;
+ H5E_auto2_t tools_func;
+ void * edata;
+ void * tools_edata;
+ 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);
@@ -95,9 +94,9 @@ int main(int argc, const char *argv[])
H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
/*-------------------------------------------------------------------------
- * process the command-line
- *-------------------------------------------------------------------------
- */
+ * process the command-line
+ *-------------------------------------------------------------------------
+ */
parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
if (enable_error_stack > 0) {
@@ -106,19 +105,19 @@ int main(int argc, const char *argv[])
}
/*-------------------------------------------------------------------------
- * 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);
@@ -156,4 +155,3 @@ h5diff_exit(int status)
HDexit(status);
}
-
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 53773a4..5455148 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -38,56 +38,56 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
*-------------------------------------------------------------------------
*/
-#define FILE1 "h5diff_basic1.h5"
-#define FILE2 "h5diff_basic2.h5"
-#define FILE3 "h5diff_types.h5"
-#define FILE4 "h5diff_dtypes.h5"
-#define FILE5 "h5diff_attr1.h5"
-#define FILE6 "h5diff_attr2.h5"
-#define FILE6a "h5diff_attr3.h5"
-#define FILE7 "h5diff_dset1.h5"
-#define FILE8 "h5diff_dset2.h5"
-#define FILE8A "h5diff_dset3.h5"
-#define FILE9 "h5diff_hyper1.h5"
-#define FILE10 "h5diff_hyper2.h5"
-#define FILE11 "h5diff_empty.h5"
-#define FILE12 "h5diff_links.h5"
-#define FILE13 "h5diff_softlinks.h5"
-#define FILE14 "h5diff_linked_softlink.h5"
-#define FILE15 "h5diff_extlink_src.h5"
-#define FILE16 "h5diff_extlink_trg.h5"
-#define FILE17 "h5diff_ext2softlink_src.h5"
-#define FILE18 "h5diff_ext2softlink_trg.h5"
-#define FILE19 "h5diff_dset_zero_dim_size1.h5"
-#define FILE20 "h5diff_dset_zero_dim_size2.h5"
-#define DANGLE_LINK_FILE1 "h5diff_danglelinks1.h5"
-#define DANGLE_LINK_FILE2 "h5diff_danglelinks2.h5"
-#define GRP_RECURSE_FILE1 "h5diff_grp_recurse1.h5"
-#define GRP_RECURSE_FILE2 "h5diff_grp_recurse2.h5"
+#define FILE1 "h5diff_basic1.h5"
+#define FILE2 "h5diff_basic2.h5"
+#define FILE3 "h5diff_types.h5"
+#define FILE4 "h5diff_dtypes.h5"
+#define FILE5 "h5diff_attr1.h5"
+#define FILE6 "h5diff_attr2.h5"
+#define FILE6a "h5diff_attr3.h5"
+#define FILE7 "h5diff_dset1.h5"
+#define FILE8 "h5diff_dset2.h5"
+#define FILE8A "h5diff_dset3.h5"
+#define FILE9 "h5diff_hyper1.h5"
+#define FILE10 "h5diff_hyper2.h5"
+#define FILE11 "h5diff_empty.h5"
+#define FILE12 "h5diff_links.h5"
+#define FILE13 "h5diff_softlinks.h5"
+#define FILE14 "h5diff_linked_softlink.h5"
+#define FILE15 "h5diff_extlink_src.h5"
+#define FILE16 "h5diff_extlink_trg.h5"
+#define FILE17 "h5diff_ext2softlink_src.h5"
+#define FILE18 "h5diff_ext2softlink_trg.h5"
+#define FILE19 "h5diff_dset_zero_dim_size1.h5"
+#define FILE20 "h5diff_dset_zero_dim_size2.h5"
+#define DANGLE_LINK_FILE1 "h5diff_danglelinks1.h5"
+#define DANGLE_LINK_FILE2 "h5diff_danglelinks2.h5"
+#define GRP_RECURSE_FILE1 "h5diff_grp_recurse1.h5"
+#define GRP_RECURSE_FILE2 "h5diff_grp_recurse2.h5"
/* same structure via external links through files */
-#define GRP_RECURSE1_EXT "h5diff_grp_recurse_ext1.h5"
-#define GRP_RECURSE2_EXT1 "h5diff_grp_recurse_ext2-1.h5"
-#define GRP_RECURSE2_EXT2 "h5diff_grp_recurse_ext2-2.h5"
-#define GRP_RECURSE2_EXT3 "h5diff_grp_recurse_ext2-3.h5"
+#define GRP_RECURSE1_EXT "h5diff_grp_recurse_ext1.h5"
+#define GRP_RECURSE2_EXT1 "h5diff_grp_recurse_ext2-1.h5"
+#define GRP_RECURSE2_EXT2 "h5diff_grp_recurse_ext2-2.h5"
+#define GRP_RECURSE2_EXT3 "h5diff_grp_recurse_ext2-3.h5"
/* same structure, same obj name with different value */
-#define EXCLUDE_FILE1_1 "h5diff_exclude1-1.h5"
-#define EXCLUDE_FILE1_2 "h5diff_exclude1-2.h5"
+#define EXCLUDE_FILE1_1 "h5diff_exclude1-1.h5"
+#define EXCLUDE_FILE1_2 "h5diff_exclude1-2.h5"
/* different structure and obj names */
-#define EXCLUDE_FILE2_1 "h5diff_exclude2-1.h5"
-#define EXCLUDE_FILE2_2 "h5diff_exclude2-2.h5"
+#define EXCLUDE_FILE2_1 "h5diff_exclude2-1.h5"
+#define EXCLUDE_FILE2_2 "h5diff_exclude2-2.h5"
/* only one file has unique objs */
-#define EXCLUDE_FILE3_1 "h5diff_exclude3-1.h5"
-#define EXCLUDE_FILE3_2 "h5diff_exclude3-2.h5"
+#define EXCLUDE_FILE3_1 "h5diff_exclude3-1.h5"
+#define EXCLUDE_FILE3_2 "h5diff_exclude3-2.h5"
/* compound type with multiple vlen string types */
-#define COMP_VL_STRS_FILE "h5diff_comp_vl_strs.h5"
+#define COMP_VL_STRS_FILE "h5diff_comp_vl_strs.h5"
/* attribute compre with verbose level */
#define ATTR_VERBOSE_LEVEL_FILE1 "h5diff_attr_v_level1.h5"
#define ATTR_VERBOSE_LEVEL_FILE2 "h5diff_attr_v_level2.h5"
/* file containing valid/invalid enum value mix */
#define ENUM_INVALID_VALUES "h5diff_enum_invalid_values.h5"
/* file with container types (array,vlen) with multiple compounds */
-#define COMPS_COMPLEX1 "compounds_array_vlen1.h5"
-#define COMPS_COMPLEX2 "compounds_array_vlen2.h5"
+#define COMPS_COMPLEX1 "compounds_array_vlen1.h5"
+#define COMPS_COMPLEX2 "compounds_array_vlen2.h5"
/* non-comparable dataset and attribute */
#define NON_COMPARBLES1 "non_comparables1.h5"
#define NON_COMPARBLES2 "non_comparables2.h5"
@@ -97,7 +97,7 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
#define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */
#define STR_SIZE 3
-#define GBLL ((unsigned long long) 1024 * 1024 *1024 )
+#define GBLL ((unsigned long long)1024 * 1024 * 1024)
#define MY_LINKCLASS 187
@@ -107,77 +107,78 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
#define SPACE1_DIM2 0
/* Error macros */
-#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC);
-#define PROGRAM_ERROR {AT(); goto error;}
+#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC);
+#define PROGRAM_ERROR \
+ { \
+ AT(); \
+ goto error; \
+ }
/* A UD link traversal function. Shouldn't actually be called. */
static hid_t
-UD_traverse(H5_ATTR_UNUSED const char * link_name,
- H5_ATTR_UNUSED hid_t cur_group, H5_ATTR_UNUSED const void * udata,
- H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id)
+UD_traverse(H5_ATTR_UNUSED const char *link_name, H5_ATTR_UNUSED hid_t cur_group,
+ H5_ATTR_UNUSED const void *udata, H5_ATTR_UNUSED size_t udata_size, H5_ATTR_UNUSED hid_t lapl_id)
{
return -1;
}
const H5L_class_t UD_link_class[1] = {{
H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)MY_LINKCLASS, /* Link type id number */
- "UD link class", /* name for debugging */
- NULL, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- UD_traverse, /* The actual traversal function */
- NULL, /* Deletion callback */
- NULL /* Query callback */
+ (H5L_type_t)MY_LINKCLASS, /* Link type id number */
+ "UD link class", /* name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
}};
-
/*-------------------------------------------------------------------------
* prototypes
*-------------------------------------------------------------------------
*/
/* tests called in main() */
-static int test_basic(const char *fname1, const char *fname2, const char *fname3);
-static int test_types(const char *fname);
-static int test_datatypes(const char *fname);
-static int test_attributes(const char *fname, int make_diffs);
-static int test_datasets(const char *fname, int make_diffs);
-static int test_special_datasets(const char *fname, int make_diffs);
-static int test_hyperslab(const char *fname, int make_diffs);
-static int test_link_name(const char *fname1);
-static int test_soft_links(const char *fname1);
-static int test_linked_softlinks(const char *fname1);
-static int test_external_links(const char *fname1, const char *fname2);
-static int test_ext2soft_links(const char *fname1, const char *fname2);
-static int test_dangle_links(const char *fname1, const char *fname2);
-static int test_group_recurse(const char *fname1, const char *fname2);
-static int test_group_recurse2(void);
-static int test_exclude_obj1(const char *fname1, const char *fname2);
-static int test_exclude_obj2(const char *fname1, const char *fname2);
-static int test_exclude_obj3(const char *fname1, const char *fname2);
-static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new);
-static int test_attributes_verbose_level(const char *fname1, const char *fname2);
-static int test_enums(const char *fname);
-static void test_comps_array(const char *fname, const char *dset,
- const char *attr, int diff, int is_file_new);
-static void test_comps_vlen(const char *fname, const char *dset,
- const char *attr, int diff, int is_file_new);
-static void test_comps_array_vlen(const char *fname, const char *dset,
- const char *attr, int diff, int is_file_new);
-static void test_comps_vlen_arry(const char *fname, const char *dset,
- const char *attr, int diff, int is_file_new);
+static int test_basic(const char *fname1, const char *fname2, const char *fname3);
+static int test_types(const char *fname);
+static int test_datatypes(const char *fname);
+static int test_attributes(const char *fname, int make_diffs);
+static int test_datasets(const char *fname, int make_diffs);
+static int test_special_datasets(const char *fname, int make_diffs);
+static int test_hyperslab(const char *fname, int make_diffs);
+static int test_link_name(const char *fname1);
+static int test_soft_links(const char *fname1);
+static int test_linked_softlinks(const char *fname1);
+static int test_external_links(const char *fname1, const char *fname2);
+static int test_ext2soft_links(const char *fname1, const char *fname2);
+static int test_dangle_links(const char *fname1, const char *fname2);
+static int test_group_recurse(const char *fname1, const char *fname2);
+static int test_group_recurse2(void);
+static int test_exclude_obj1(const char *fname1, const char *fname2);
+static int test_exclude_obj2(const char *fname1, const char *fname2);
+static int test_exclude_obj3(const char *fname1, const char *fname2);
+static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new);
+static int test_attributes_verbose_level(const char *fname1, const char *fname2);
+static int test_enums(const char *fname);
+static void test_comps_array(const char *fname, const char *dset, const char *attr, int diff,
+ int is_file_new);
+static void test_comps_vlen(const char *fname, const char *dset, const char *attr, int diff, int is_file_new);
+static void test_comps_array_vlen(const char *fname, const char *dset, const char *attr, int diff,
+ int is_file_new);
+static void test_comps_vlen_arry(const char *fname, const char *dset, const char *attr, int diff,
+ int is_file_new);
static void test_data_nocomparables(const char *fname, int diff);
static void test_objs_nocomparables(const char *fname1, const char *fname2);
static void test_objs_strings(const char *fname, const char *fname2);
/* called by test_attributes() and test_datasets() */
-static void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs);
-static void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs);
-static void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs);
+static void write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs);
+static void write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs);
+static void write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs);
static void gen_datareg(hid_t fid, int make_diffs);
/* utilities */
-static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf);
+static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf);
static herr_t write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf);
/*-------------------------------------------------------------------------
@@ -188,7 +189,8 @@ static herr_t write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name
*-------------------------------------------------------------------------
*/
-int main(void)
+int
+main(void)
{
test_basic(FILE1, FILE2, FILE11);
@@ -241,16 +243,16 @@ int main(void)
test_comp_vlen_strings(COMP_VL_STRS_FILE, "group_copy", 0);
/* diff when invalid enum values are present.
- * This will probably grow to involve more extensive testing of
- * enums so it has been given its own test file and test (apart
- * from the basic type testing).
- */
+ * This will probably grow to involve more extensive testing of
+ * enums so it has been given its own test file and test (apart
+ * from the basic type testing).
+ */
test_enums(ENUM_INVALID_VALUES);
/* -------------------------------------------------
- * Create test files with dataset and attribute with container types
- * (array, vlen) with multiple nested compound types.
- */
+ * Create test files with dataset and attribute with container types
+ * (array, vlen) with multiple nested compound types.
+ */
/* file1 */
test_comps_array(COMPS_COMPLEX1, "dset1", "attr1", 0, 1);
test_comps_vlen(COMPS_COMPLEX1, "dset2", "attr2", 0, 0);
@@ -263,10 +265,10 @@ int main(void)
test_comps_vlen_arry(COMPS_COMPLEX2, "dset4", "attr4", 5, 0);
/*-------------------------------------------------
- * Create test files with non-comparable dataset and attributes with
- * comparable datasets and attributes. All the comparables should display
- * differences.
- */
+ * Create test files with non-comparable dataset and attributes with
+ * comparable datasets and attributes. All the comparables should display
+ * differences.
+ */
test_data_nocomparables(NON_COMPARBLES1, 0);
test_data_nocomparables(NON_COMPARBLES2, 5);
@@ -288,13 +290,13 @@ int main(void)
*-------------------------------------------------------------------------
*/
-static
-int test_basic(const char *fname1, const char *fname2, const char *fname3)
+static int
+test_basic(const char *fname1, const char *fname2, const char *fname3)
{
- hid_t fid1 = -1, fid2 = H5I_INVALID_HID;
- hid_t gid1 = -1, gid2 = -1, gid3 = H5I_INVALID_HID;
- hsize_t dims1[1] = { 6 };
- hsize_t dims2[2] = { 3, 2 };
+ hid_t fid1 = -1, fid2 = H5I_INVALID_HID;
+ hid_t gid1 = -1, gid2 = -1, gid3 = H5I_INVALID_HID;
+ hsize_t dims1[1] = {6};
+ hsize_t dims2[2] = {3, 2};
/* create the empty file */
if ((fid1 = H5Fcreate(fname3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
@@ -307,9 +309,9 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
}
/*-------------------------------------------------------------------------
- * create two files
- *-------------------------------------------------------------------------
- */
+ * create two files
+ *-------------------------------------------------------------------------
+ */
if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
@@ -317,158 +319,141 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
goto out;
/*-------------------------------------------------------------------------
- * create groups
- *-------------------------------------------------------------------------
- */
+ * create groups
+ *-------------------------------------------------------------------------
+ */
gid1 = H5Gcreate2(fid1, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
gid2 = H5Gcreate2(fid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
gid3 = H5Gcreate2(fid2, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * tests:
- * # 1.1 normal mode
- * # 1.2 normal mode with objects
- * # 1.3 report mode
- * # 1.4 report mode with objects
- * # 1.5 with -d
- *-------------------------------------------------------------------------
- */
+ * tests:
+ * # 1.1 normal mode
+ * # 1.2 normal mode with objects
+ * # 1.3 report mode
+ * # 1.4 report mode with objects
+ * # 1.5 with -d
+ *-------------------------------------------------------------------------
+ */
{
- double data1[3][2] =
- { { 1.0F, 1.0F }, { 1.00F, 1.000F }, { 0.0F, 0.0F } };
- double data2[3][2] =
- { { 0.0F, 1.1F }, { 1.01F, 1.001F }, { 0.0F, 1.0F } };
- double data3[3][2] = { { 100.0F, 100.0F }, { 100.00F, 100.000F }, {
- 100.0F, 100.0F } };
- double data4[3][2] = { { 105.0F, 120.0F }, { 160.00F, 95.000F }, {
- 80.0F, 40.0F } };
+ double data1[3][2] = {{1.0F, 1.0F}, {1.00F, 1.000F}, {0.0F, 0.0F}};
+ double data2[3][2] = {{0.0F, 1.1F}, {1.01F, 1.001F}, {0.0F, 1.0F}};
+ double data3[3][2] = {{100.0F, 100.0F}, {100.00F, 100.000F}, {100.0F, 100.0F}};
+ double data4[3][2] = {{105.0F, 120.0F}, {160.00F, 95.000F}, {80.0F, 40.0F}};
write_dset(gid1, 2, dims2, "dset1", H5T_NATIVE_DOUBLE, data1);
write_dset(gid2, 2, dims2, "dset2", H5T_NATIVE_DOUBLE, data2);
write_dset(gid1, 2, dims2, "dset3", H5T_NATIVE_DOUBLE, data3);
write_dset(gid2, 2, dims2, "dset4", H5T_NATIVE_DOUBLE, data4);
write_dset(gid2, 2, dims2, "dset1", H5T_NATIVE_DOUBLE, data2);
-
}
/*-------------------------------------------------------------------------
- * relative error, compare divide by zero, both zero
- * # 1.6.1 with -p (int)
- *-------------------------------------------------------------------------
- */
+ * relative error, compare divide by zero, both zero
+ * # 1.6.1 with -p (int)
+ *-------------------------------------------------------------------------
+ */
{
- int data5[3][2] = { { 100, 100 }, { 100, 0 }, { 0, 100 } };
- int data6[3][2] = { { 120, 80 }, { 0, 100 }, { 0, 50 } };
+ int data5[3][2] = {{100, 100}, {100, 0}, {0, 100}};
+ int data6[3][2] = {{120, 80}, {0, 100}, {0, 50}};
write_dset(gid1, 2, dims2, "dset5", H5T_NATIVE_INT, data5);
write_dset(gid1, 2, dims2, "dset6", H5T_NATIVE_INT, data6);
-
}
/*-------------------------------------------------------------------------
- * relative error, compare divide by zero, both zero
- * # 1.6.2 with -p (unsigned long long)
- *-------------------------------------------------------------------------
- */
+ * relative error, compare divide by zero, both zero
+ * # 1.6.2 with -p (unsigned long long)
+ *-------------------------------------------------------------------------
+ */
{
- unsigned long long data7[3][2] =
- { { 100, 100 }, { 100, 0 }, { 0, 100 } };
- unsigned long long data8[3][2] = { { 120, 80 }, { 0, 100 }, { 0, 50 } };
+ unsigned long long data7[3][2] = {{100, 100}, {100, 0}, {0, 100}};
+ unsigned long long data8[3][2] = {{120, 80}, {0, 100}, {0, 50}};
write_dset(gid1, 2, dims2, "dset7", H5T_NATIVE_ULLONG, data7);
write_dset(gid1, 2, dims2, "dset8", H5T_NATIVE_ULLONG, data8);
-
}
/*-------------------------------------------------------------------------
- * relative error, compare divide by zero, both zero
- * # 1.6.3 with -p (double)
- *
- * A B 1-B/A %
- * 100 120 0.2 20
- * 100 80 0.2 20
- * 100 0 1 100
- * 0 100 #DIV/0! #DIV/0!
- * 0 0 #DIV/0! #DIV/0!
- * 100 50 0.5 50
- *-------------------------------------------------------------------------
- */
+ * relative error, compare divide by zero, both zero
+ * # 1.6.3 with -p (double)
+ *
+ * A B 1-B/A %
+ * 100 120 0.2 20
+ * 100 80 0.2 20
+ * 100 0 1 100
+ * 0 100 #DIV/0! #DIV/0!
+ * 0 0 #DIV/0! #DIV/0!
+ * 100 50 0.5 50
+ *-------------------------------------------------------------------------
+ */
{
- double data9[3][2] = { { 100.0F, 100.0F }, { 100.0F, 0.0F }, { 0.0F,
- 100.0F } };
- double data10[3][2] = { { 120.0F, 80.0F }, { 0.0F, 100.0F }, { 0.0F,
- 50.0F } };
+ double data9[3][2] = {{100.0F, 100.0F}, {100.0F, 0.0F}, {0.0F, 100.0F}};
+ double data10[3][2] = {{120.0F, 80.0F}, {0.0F, 100.0F}, {0.0F, 50.0F}};
write_dset(gid1, 2, dims2, "dset9", H5T_NATIVE_DOUBLE, data9);
write_dset(gid1, 2, dims2, "dset10", H5T_NATIVE_DOUBLE, data10);
-
}
/*-------------------------------------------------------------------------
- * test floating point comparison
- *-------------------------------------------------------------------------
- */
+ * test floating point comparison
+ *-------------------------------------------------------------------------
+ */
{
/* epsilon = 0.0000001 = 1e-7
- * system epsilon for float : FLT_EPSILON = 1.19209E-07
- */
- float data11[3][2] = { { 0.000000f, 0.0000001f }, { 0.0000001f,
- 0.00000022f }, { 0.0000001f, 0.0000001f } };
- float data12[3][2] = { { 0.000000f, 0.0000002f }, { 0.0000003f,
- 0.0000001f }, { 0.000000f, 0.0000001f } };
+ * system epsilon for float : FLT_EPSILON = 1.19209E-07
+ */
+ float data11[3][2] = {{0.000000f, 0.0000001f}, {0.0000001f, 0.00000022f}, {0.0000001f, 0.0000001f}};
+ float data12[3][2] = {{0.000000f, 0.0000002f}, {0.0000003f, 0.0000001f}, {0.000000f, 0.0000001f}};
/* epsilon = 0.0000000000000001 = 1e-16
- * system epsilon for double : DBL_EPSILON = 2.22045E-16
- */
- double data13[3][2] = { { H5_DOUBLE(0.0000000000000000), H5_DOUBLE(
- 0.0000000000000001) }, { H5_DOUBLE(0.0000000000000001),
- H5_DOUBLE(0.0000000000000000) }, { H5_DOUBLE(
- 0.00000000000000033), H5_DOUBLE(0.0000000000000001) } };
- double data14[3][2] = { { H5_DOUBLE(0.0000000000000000), H5_DOUBLE(
- 0.0000000000000004) }, { H5_DOUBLE(0.0000000000000002),
- H5_DOUBLE(0.0000000000000001) }, { H5_DOUBLE(
- 0.0000000000000001), H5_DOUBLE(0.00000000000000000) } };
+ * system epsilon for double : DBL_EPSILON = 2.22045E-16
+ */
+ double data13[3][2] = {{H5_DOUBLE(0.0000000000000000), H5_DOUBLE(0.0000000000000001)},
+ {H5_DOUBLE(0.0000000000000001), H5_DOUBLE(0.0000000000000000)},
+ {H5_DOUBLE(0.00000000000000033), H5_DOUBLE(0.0000000000000001)}};
+ double data14[3][2] = {{H5_DOUBLE(0.0000000000000000), H5_DOUBLE(0.0000000000000004)},
+ {H5_DOUBLE(0.0000000000000002), H5_DOUBLE(0.0000000000000001)},
+ {H5_DOUBLE(0.0000000000000001), H5_DOUBLE(0.00000000000000000)}};
write_dset(gid1, 2, dims2, "fp1", H5T_NATIVE_FLOAT, data11);
write_dset(gid1, 2, dims2, "fp2", H5T_NATIVE_FLOAT, data12);
write_dset(gid1, 2, dims2, "d1", H5T_NATIVE_DOUBLE, data13);
write_dset(gid1, 2, dims2, "d2", H5T_NATIVE_DOUBLE, data14);
-
}
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != 0
{
/*-------------------------------------------------------------------------
- * H5T_NATIVE_LDOUBLE
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_LDOUBLE
+ *-------------------------------------------------------------------------
+ */
- long double data15[3][2] = { {1.0L,1.0L}, {1.0L,1.0L}, {1.0L,1.0L}};
-
- write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15);
+ long double data15[3][2] = {{1.0L, 1.0L}, {1.0L, 1.0L}, {1.0L, 1.0L}};
+ write_dset(gid1, 2, dims2, "ld", H5T_NATIVE_LDOUBLE, data15);
}
#endif
/*-------------------------------------------------------------------------
- * NaNs in H5T_NATIVE_FLOAT
- *-------------------------------------------------------------------------
- */
+ * NaNs in H5T_NATIVE_FLOAT
+ *-------------------------------------------------------------------------
+ */
{
float data15[6];
float data16[6];
- data15[0] = (float) HDsqrt(-1.0F);
+ data15[0] = (float)HDsqrt(-1.0F);
data15[1] = 1.0F;
- data15[2] = (float) HDsqrt(-1.0F);
+ data15[2] = (float)HDsqrt(-1.0F);
data15[3] = 1.0F;
data15[4] = 1.0F;
data15[5] = 1.0F;
- data16[0] = (float) HDsqrt(-1.0F);
- data16[1] = (float) HDsqrt(-1.0F);
+ data16[0] = (float)HDsqrt(-1.0F);
+ data16[1] = (float)HDsqrt(-1.0F);
data16[2] = 1.0F;
data16[3] = 1.0F;
data16[4] = 1.0F;
@@ -476,13 +461,12 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
write_dset(gid1, 1, dims1, "fp15", H5T_NATIVE_FLOAT, data15);
write_dset(gid1, 1, dims1, "fp16", H5T_NATIVE_FLOAT, data16);
-
}
/*-------------------------------------------------------------------------
- * NaNs in H5T_NATIVE_DOUBLE
- *-------------------------------------------------------------------------
- */
+ * NaNs in H5T_NATIVE_DOUBLE
+ *-------------------------------------------------------------------------
+ */
{
double data17[6];
@@ -508,15 +492,15 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
}
/*------------------------------------------------------------------------
- * INFINITY values
- *------------------------------------------------------------------------
- */
+ * INFINITY values
+ *------------------------------------------------------------------------
+ */
{
- float data19[6];
+ float data19[6];
double data20[6];
- data19[0] = data19[1] = data19[2] = (float) HDlog(0.0F);
- data19[3] = data19[4] = data19[5] = (float) -HDlog(0.0F);
+ data19[0] = data19[1] = data19[2] = (float)HDlog(0.0F);
+ data19[3] = data19[4] = data19[5] = (float)-HDlog(0.0F);
data20[0] = data20[1] = data20[2] = HDlog(0.0F);
data20[3] = data20[4] = data20[5] = -HDlog(0.0F);
@@ -528,39 +512,38 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
}
/*-------------------------------------------------------------------------
- * NaNs in H5T_NATIVE_DOUBLE and H5T_NATIVE_FLOAT inside H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * NaNs in H5T_NATIVE_DOUBLE and H5T_NATIVE_FLOAT inside H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
{
typedef struct cmp1_t {
double d;
- float f;
+ float f;
} cmp1_t;
- cmp1_t buf1[2];
- cmp1_t buf2[2];
- hsize_t dims[1] = { 2 };
- size_t type_size;
- hid_t tid;
+ cmp1_t buf1[2];
+ cmp1_t buf2[2];
+ hsize_t dims[1] = {2};
+ size_t type_size;
+ hid_t tid;
buf1[0].d = HDsqrt(-1.0F);
- buf1[0].f = (float) HDsqrt(-1.0F);
+ buf1[0].f = (float)HDsqrt(-1.0F);
buf2[0].d = HDsqrt(-1.0F);
- buf2[0].f = (float) HDsqrt(-1.0F);
+ buf2[0].f = (float)HDsqrt(-1.0F);
buf1[1].d = HDsqrt(-1.0F);
- buf1[1].f = (float) HDsqrt(-1.0F);
+ buf1[1].f = (float)HDsqrt(-1.0F);
buf2[1].d = 0.0F;
buf2[1].f = 0.0F;
type_size = sizeof(cmp1_t);
- tid = H5Tcreate(H5T_COMPOUND, type_size);
+ tid = H5Tcreate(H5T_COMPOUND, type_size);
H5Tinsert(tid, "d", HOFFSET(cmp1_t, d), H5T_NATIVE_DOUBLE);
H5Tinsert(tid, "f", HOFFSET(cmp1_t, f), H5T_NATIVE_FLOAT);
write_dset(gid1, 1, dims, "dset11", tid, buf1);
write_dset(gid1, 1, dims, "dset12", tid, buf2);
H5Tclose(tid);
-
}
/* not comparable objects */
@@ -568,11 +551,11 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
typedef struct cmp1_t {
double d;
- int i;
+ int i;
} cmp1_t;
typedef struct cmp2_t {
- int i;
+ int i;
double d;
} cmp2_t;
@@ -580,17 +563,17 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
int i;
} cmp3_t;
- double data2[6] = { 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F };
- int data3[6] = { 0, 0, 0, 0, 0, 0 };
- int data4[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } };
- int data5[2][2] = { { 0, 0 }, { 0, 0 } };
- unsigned int data6[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } };
- cmp1_t data7[1] = { { 1.0f, 2 } };
- cmp2_t data8[1] = { { 1, 2.0f } };
- hsize_t dims3[2] = { 2, 2 };
- hsize_t dims4[1] = { 1 };
- size_t type_size;
- hid_t tid;
+ double data2[6] = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
+ int data3[6] = {0, 0, 0, 0, 0, 0};
+ int data4[3][2] = {{0, 0}, {0, 0}, {0, 0}};
+ int data5[2][2] = {{0, 0}, {0, 0}};
+ unsigned int data6[3][2] = {{0, 0}, {0, 0}, {0, 0}};
+ cmp1_t data7[1] = {{1.0f, 2}};
+ cmp2_t data8[1] = {{1, 2.0f}};
+ hsize_t dims3[2] = {2, 2};
+ hsize_t dims4[1] = {1};
+ size_t type_size;
+ hid_t tid;
write_dset(gid3, 1, dims1, "dset1", H5T_NATIVE_DOUBLE, NULL);
write_dset(gid3, 1, dims1, "dset2", H5T_NATIVE_DOUBLE, data2);
@@ -601,14 +584,14 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
/* case of compound with different type members */
type_size = sizeof(cmp1_t);
- tid = H5Tcreate(H5T_COMPOUND, type_size);
+ tid = H5Tcreate(H5T_COMPOUND, type_size);
H5Tinsert(tid, "d", HOFFSET(cmp1_t, d), H5T_NATIVE_DOUBLE);
H5Tinsert(tid, "i", HOFFSET(cmp1_t, i), H5T_NATIVE_INT);
write_dset(gid3, 1, dims4, "dset7", tid, data7);
H5Tclose(tid);
type_size = sizeof(cmp2_t);
- tid = H5Tcreate(H5T_COMPOUND, type_size);
+ tid = H5Tcreate(H5T_COMPOUND, type_size);
H5Tinsert(tid, "i", HOFFSET(cmp2_t, i), H5T_NATIVE_INT);
H5Tinsert(tid, "d", HOFFSET(cmp2_t, d), H5T_NATIVE_DOUBLE);
write_dset(gid3, 1, dims4, "dset8", tid, data8);
@@ -616,17 +599,16 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
/* case of compound with different number of members */
type_size = sizeof(cmp3_t);
- tid = H5Tcreate(H5T_COMPOUND, type_size);
+ tid = H5Tcreate(H5T_COMPOUND, type_size);
H5Tinsert(tid, "i", HOFFSET(cmp2_t, i), H5T_NATIVE_INT);
write_dset(gid3, 1, dims4, "dset9", tid, NULL);
H5Tclose(tid);
-
}
/*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
+ * close
+ *-------------------------------------------------------------------------
+ */
H5Gclose(gid1);
H5Gclose(gid2);
H5Gclose(gid3);
@@ -647,18 +629,18 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
-int test_types(const char *fname)
+static int
+test_types(const char *fname)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hid_t tid1 = H5I_INVALID_HID;
- hid_t tid2 = H5I_INVALID_HID;
- herr_t status;
- hsize_t dims[1] = { 1 };
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t tid1 = H5I_INVALID_HID;
+ hid_t tid2 = H5I_INVALID_HID;
+ herr_t status;
+ hsize_t dims[1] = {1};
typedef struct s1_t {
- int a;
+ int a;
float b;
} s1_t;
typedef struct s2_t {
@@ -666,30 +648,30 @@ int test_types(const char *fname)
} s2_t;
/*-------------------------------------------------------------------------
- * Create one file
- *-------------------------------------------------------------------------
- */
+ * Create one file
+ *-------------------------------------------------------------------------
+ */
fid1 = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * H5G_DATASET
- *-------------------------------------------------------------------------
- */
+ * H5G_DATASET
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 1, dims, "dset", H5T_NATIVE_INT, 0);
/*-------------------------------------------------------------------------
- * H5G_GROUP
- *-------------------------------------------------------------------------
- */
- gid1 = H5Gcreate2(fid1, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ * H5G_GROUP
+ *-------------------------------------------------------------------------
+ */
+ gid1 = H5Gcreate2(fid1, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Gclose(gid1);
- gid2 = H5Gcreate2(fid1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid2 = H5Gcreate2(fid1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Gclose(gid2);
/*-------------------------------------------------------------------------
- * H5G_TYPE
- *-------------------------------------------------------------------------
- */
+ * H5G_TYPE
+ *-------------------------------------------------------------------------
+ */
/* create and commit datatype 1 */
tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
@@ -704,25 +686,25 @@ int test_types(const char *fname)
H5Tclose(tid2);
/*-------------------------------------------------------------------------
- * H5G_LINK
- *-------------------------------------------------------------------------
- */
+ * H5G_LINK
+ *-------------------------------------------------------------------------
+ */
status = H5Lcreate_soft("g1", fid1, "l1", H5P_DEFAULT, H5P_DEFAULT);
status = H5Lcreate_soft("g2", fid1, "l2", H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * H5G_UDLINK
- *-------------------------------------------------------------------------
- */
+ * H5G_UDLINK
+ *-------------------------------------------------------------------------
+ */
H5Lcreate_external("filename", "objname", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT);
H5Lregister(UD_link_class);
- H5Lcreate_ud(fid1, "ud_link", (H5L_type_t) MY_LINKCLASS, NULL, (size_t) 0, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_ud(fid1, "ud_link", (H5L_type_t)MY_LINKCLASS, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * Close
- *-------------------------------------------------------------------------
- */
+ * Close
+ *-------------------------------------------------------------------------
+ */
status = H5Fclose(fid1);
return status;
}
@@ -772,138 +754,138 @@ int test_types(const char *fname)
*
*-------------------------------------------------------------------------
*/
-static
-int test_datatypes(const char *fname)
+static int
+test_datatypes(const char *fname)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t dset = H5I_INVALID_HID;
- hsize_t dims[2] = { 3, 2 };
- herr_t status;
- char buf1a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
- char buf1b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } };
- short buf2a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
- short buf2b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } };
- int buf3a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
- int buf3b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } };
- long buf4a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
- long buf4b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } };
- float buf5a[3][2] = { { 1.0F, 1.0F }, { 1.0F, 1.0F }, { 1.0F, 1.0F } };
- float buf5b[3][2] = { { 1.0F, 1.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } };
- double buf6a[3][2] = { { 1.0F, 1.0F }, { 1.0F, 1.0F }, { 1.0F, 1.0F } };
- double buf6b[3][2] = { { 1.0F, 1.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } };
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
+ hsize_t dims[2] = {3, 2};
+ herr_t status;
+ char buf1a[3][2] = {{1, 1}, {1, 1}, {1, 1}};
+ char buf1b[3][2] = {{1, 1}, {3, 4}, {5, 6}};
+ short buf2a[3][2] = {{1, 1}, {1, 1}, {1, 1}};
+ short buf2b[3][2] = {{1, 1}, {3, 4}, {5, 6}};
+ int buf3a[3][2] = {{1, 1}, {1, 1}, {1, 1}};
+ int buf3b[3][2] = {{1, 1}, {3, 4}, {5, 6}};
+ long buf4a[3][2] = {{1, 1}, {1, 1}, {1, 1}};
+ long buf4b[3][2] = {{1, 1}, {3, 4}, {5, 6}};
+ float buf5a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}};
+ float buf5b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}};
+ double buf6a[3][2] = {{1.0F, 1.0F}, {1.0F, 1.0F}, {1.0F, 1.0F}};
+ double buf6b[3][2] = {{1.0F, 1.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}};
/*unsigned/signed test
signed char -128 to 127
unsigned char 0 to 255
*/
- char buf7a[3][2] = { { -1, -128 }, { -1, -1 }, { -1, -1 } };
- unsigned char buf7b[3][2] = { { 1, 128 }, { 1, 1 }, { 1, 1 } };
+ char buf7a[3][2] = {{-1, -128}, {-1, -1}, {-1, -1}};
+ unsigned char buf7b[3][2] = {{1, 128}, {1, 1}, {1, 1}};
/* long long test */
- long long buf8a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
- long long buf8b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } };
- unsigned long long buf9a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
- unsigned long long buf9b[3][2] = { { 1, 1 }, { 3, 4 }, { 5, 6 } };
+ long long buf8a[3][2] = {{1, 1}, {1, 1}, {1, 1}};
+ long long buf8b[3][2] = {{1, 1}, {3, 4}, {5, 6}};
+ unsigned long long buf9a[3][2] = {{1, 1}, {1, 1}, {1, 1}};
+ unsigned long long buf9b[3][2] = {{1, 1}, {3, 4}, {5, 6}};
- unsigned int buf10a[3][2] = { { UIMAX, 1 }, { 1, 1 }, { 1, 1 } };
- unsigned int buf10b[3][2] = { { UIMAX - 1, 1 }, { 3, 4 }, { 5, 6 } };
+ unsigned int buf10a[3][2] = {{UIMAX, 1}, {1, 1}, {1, 1}};
+ unsigned int buf10b[3][2] = {{UIMAX - 1, 1}, {3, 4}, {5, 6}};
- unsigned short buf11a[3][2] = { { 204, 205 }, { 2, 3 }, { 1, 1 } };
- unsigned int buf11b[3][2] = { { 204, 205 }, { 2, 3 }, { 1, 1 } };
+ unsigned short buf11a[3][2] = {{204, 205}, {2, 3}, {1, 1}};
+ unsigned int buf11b[3][2] = {{204, 205}, {2, 3}, {1, 1}};
/*-------------------------------------------------------------------------
- * Create a file
- *-------------------------------------------------------------------------
- */
+ * Create a file
+ *-------------------------------------------------------------------------
+ */
fid1 = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * Check for different storage order. Give a warning if they are different
- *-------------------------------------------------------------------------
- */
+ * Check for different storage order. Give a warning if they are different
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset0a", H5T_STD_I16LE, buf2a);
write_dset(fid1, 2, dims, "dset0b", H5T_STD_I32LE, buf3b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_CHAR
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_CHAR
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset1a", H5T_NATIVE_CHAR, buf1a);
write_dset(fid1, 2, dims, "dset1b", H5T_NATIVE_CHAR, buf1b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_SHORT
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_SHORT
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset2a", H5T_NATIVE_SHORT, buf2a);
write_dset(fid1, 2, dims, "dset2b", H5T_NATIVE_SHORT, buf2b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_INT
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_INT
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset3a", H5T_NATIVE_INT, buf3a);
write_dset(fid1, 2, dims, "dset3b", H5T_NATIVE_INT, buf3b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_LONG
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_LONG
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset4a", H5T_NATIVE_LONG, buf4a);
write_dset(fid1, 2, dims, "dset4b", H5T_NATIVE_LONG, buf4b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_FLOAT
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset5a", H5T_NATIVE_FLOAT, buf5a);
write_dset(fid1, 2, dims, "dset5b", H5T_NATIVE_FLOAT, buf5b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_DOUBLE
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_DOUBLE
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset6a", H5T_NATIVE_DOUBLE, buf6a);
write_dset(fid1, 2, dims, "dset6b", H5T_NATIVE_DOUBLE, buf6b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_CHAR and H5T_NATIVE_UCHAR
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_CHAR and H5T_NATIVE_UCHAR
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset7a", H5T_NATIVE_CHAR, buf7a);
write_dset(fid1, 2, dims, "dset7b", H5T_NATIVE_UCHAR, buf7b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_LLONG
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_LLONG
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset8a", H5T_NATIVE_LLONG, buf8a);
write_dset(fid1, 2, dims, "dset8b", H5T_NATIVE_LLONG, buf8b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_ULLONG
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_ULLONG
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset9a", H5T_NATIVE_ULLONG, buf9a);
write_dset(fid1, 2, dims, "dset9b", H5T_NATIVE_ULLONG, buf9b);
/*-------------------------------------------------------------------------
- * H5T_NATIVE_INT
- *-------------------------------------------------------------------------
- */
+ * H5T_NATIVE_INT
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset10a", H5T_NATIVE_UINT, buf10a);
write_dset(fid1, 2, dims, "dset10b", H5T_NATIVE_UINT, buf10b);
/*-------------------------------------------------------------------------
- * Same type class, different size
- *-------------------------------------------------------------------------
- */
+ * Same type class, different size
+ *-------------------------------------------------------------------------
+ */
write_dset(fid1, 2, dims, "dset11a", H5T_STD_U16LE, buf11a);
dset = H5Dopen2(fid1, "dset11a", H5P_DEFAULT);
write_attr(dset, 2, dims, "attr", H5T_STD_U16LE, buf11a);
@@ -915,9 +897,9 @@ int test_datatypes(const char *fname)
H5Dclose(dset);
/*-------------------------------------------------------------------------
- * Close
- *-------------------------------------------------------------------------
- */
+ * Close
+ *-------------------------------------------------------------------------
+ */
status = H5Fclose(fid1);
return status;
}
@@ -962,44 +944,44 @@ int test_datatypes(const char *fname)
*
*-------------------------------------------------------------------------
*/
-static
-int test_attributes(const char *file, int make_diffs /* flag to modify data buffers */)
+static int
+test_attributes(const char *file, int make_diffs /* flag to modify data buffers */)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t root_id = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hsize_t dims[1] = { 2 };
- herr_t status;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t root_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hsize_t dims[1] = {2};
+ herr_t status;
/* Create a file */
if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
/* Create a 1D dataset */
- sid = H5Screate_simple(1, dims, NULL);
- did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Sclose(sid);
assert(status >= 0);
/* Create groups */
- gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
root_id = H5Gopen2(fid, "/", H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * write a series of attributes on the dataset, group, and root group
- *-------------------------------------------------------------------------
- */
+ * write a series of attributes on the dataset, group, and root group
+ *-------------------------------------------------------------------------
+ */
if (make_diffs > 1) {
write_attr_strings(did, "dset", fid, make_diffs);
- write_attr_strings(gid, NULL, (hid_t) 0, make_diffs);
- write_attr_strings(root_id, NULL, (hid_t) 0, make_diffs);
+ write_attr_strings(gid, NULL, (hid_t)0, make_diffs);
+ write_attr_strings(root_id, NULL, (hid_t)0, make_diffs);
}
else {
write_attr_in(did, "dset", fid, make_diffs);
- write_attr_in(gid, NULL, (hid_t) 0, make_diffs);
- write_attr_in(root_id, NULL, (hid_t) 0, make_diffs);
+ write_attr_in(gid, NULL, (hid_t)0, make_diffs);
+ write_attr_in(root_id, NULL, (hid_t)0, make_diffs);
}
/* Close */
@@ -1024,34 +1006,35 @@ int test_attributes(const char *file, int make_diffs /* flag to modify data buff
*
*-------------------------------------------------------------------------
*/
-static int test_attributes_verbose_level(const char *fname1, const char *fname2)
+static int
+test_attributes_verbose_level(const char *fname1, const char *fname2)
{
herr_t status = SUCCEED;
- hid_t fid1 = -1, fid2 = H5I_INVALID_HID;
- hid_t f1_gid = -1, f2_gid = H5I_INVALID_HID;
- hid_t f1_gid2 = -1, f2_gid2 = H5I_INVALID_HID;
- hid_t f1_gid3 = -1, f2_gid3 = H5I_INVALID_HID;
- hid_t f1_gid4 = -1, f2_gid4 = H5I_INVALID_HID;
- hid_t f1_did = -1, f2_did = H5I_INVALID_HID;
- hid_t f1_sid = -1, f2_sid = H5I_INVALID_HID;
- hid_t f1_tid = -1, f2_tid = H5I_INVALID_HID;
+ hid_t fid1 = -1, fid2 = H5I_INVALID_HID;
+ hid_t f1_gid = -1, f2_gid = H5I_INVALID_HID;
+ hid_t f1_gid2 = -1, f2_gid2 = H5I_INVALID_HID;
+ hid_t f1_gid3 = -1, f2_gid3 = H5I_INVALID_HID;
+ hid_t f1_gid4 = -1, f2_gid4 = H5I_INVALID_HID;
+ hid_t f1_did = -1, f2_did = H5I_INVALID_HID;
+ hid_t f1_sid = -1, f2_sid = H5I_INVALID_HID;
+ hid_t f1_tid = -1, f2_tid = H5I_INVALID_HID;
/* dset */
- hsize_t dset_dims[1] = { 3 };
- int dset_data[3] = { 0, 1, 2 };
+ hsize_t dset_dims[1] = {3};
+ int dset_data[3] = {0, 1, 2};
/* common attrs dim */
- hsize_t attr_dims[1] = { 2 };
+ hsize_t attr_dims[1] = {2};
/* file1 attr */
- int f1_attr_idata[2] = { 1, 2 }; /* integer */
- float f1_attr_fdata[2] = { 1.1F, 2.2F }; /* float */
+ int f1_attr_idata[2] = {1, 2}; /* integer */
+ float f1_attr_fdata[2] = {1.1F, 2.2F}; /* float */
/* file2 attr */
- int f2_attr_idata[2] = { 2, 3 }; /* integer */
- float f2_attr_fdata[2] = { 2.1F, 3.2F }; /* float */
+ int f2_attr_idata[2] = {2, 3}; /* integer */
+ float f2_attr_fdata[2] = {2.1F, 3.2F}; /* float */
/*----------------------------------------------------------------------
- * Create file1
- *-----------------------------------------------------------------------*/
+ * Create file1
+ *-----------------------------------------------------------------------*/
if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
status = FAIL;
@@ -1059,8 +1042,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * Groups
- */
+ * Groups
+ */
f1_gid = H5Gcreate2(fid1, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (f1_gid < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
@@ -1090,8 +1073,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * Datasets
- */
+ * Datasets
+ */
f1_sid = H5Screate_simple(1, dset_dims, NULL);
f1_did = H5Dcreate2(fid1, "dset", H5T_NATIVE_INT, f1_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (f1_did == FAIL) {
@@ -1107,8 +1090,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * Named Datatype
- */
+ * Named Datatype
+ */
f1_tid = H5Tcopy(H5T_NATIVE_INT);
status = H5Tcommit2(fid1, "ntype", f1_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -1118,8 +1101,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------------------------------------------
- * Create file2
- *-----------------------------------------------------------------------*/
+ * Create file2
+ *-----------------------------------------------------------------------*/
if ((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
status = FAIL;
@@ -1127,8 +1110,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * Groups
- */
+ * Groups
+ */
f2_gid = H5Gcreate2(fid2, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (f2_gid < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
@@ -1158,8 +1141,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * Datasets
- */
+ * Datasets
+ */
f2_sid = H5Screate_simple(1, dset_dims, NULL);
f2_did = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, f2_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (f2_did == FAIL) {
@@ -1175,8 +1158,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * Named Datatype
- */
+ * Named Datatype
+ */
f2_tid = H5Tcopy(H5T_NATIVE_INT);
status = H5Tcommit2(fid2, "ntype", f2_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -1186,9 +1169,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
}
/*----------------------------------
- * CASE1 - Same attr number, all Same attr name
- * add attr to group
- */
+ * CASE1 - Same attr number, all Same attr name
+ * add attr to group
+ */
write_attr(f1_gid, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata);
write_attr(f1_gid, 1, attr_dims, "float1", H5T_NATIVE_FLOAT, f1_attr_fdata);
@@ -1196,9 +1179,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
write_attr(f2_gid, 1, attr_dims, "float1", H5T_NATIVE_FLOAT, f2_attr_fdata);
/*----------------------------------
- * CASE2 - Same attr number, some Same attr name
- * add attr to dset
- */
+ * CASE2 - Same attr number, some Same attr name
+ * add attr to dset
+ */
write_attr(f1_did, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata);
write_attr(f1_did, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata);
@@ -1206,9 +1189,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
write_attr(f2_did, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f2_attr_fdata);
/*----------------------------------
- * CASE3 - Same attr number, all different attr name
- * add attr to ntype
- */
+ * CASE3 - Same attr number, all different attr name
+ * add attr to ntype
+ */
write_attr(f1_tid, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata);
write_attr(f1_tid, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata);
write_attr(f1_tid, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f1_attr_fdata);
@@ -1218,9 +1201,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
write_attr(f2_tid, 1, attr_dims, "float6", H5T_NATIVE_FLOAT, f2_attr_fdata);
/*----------------------------------
- * CASE4 - Different attr number, some same attr name (vs file2-g2)
- * add attr to g2
- */
+ * CASE4 - Different attr number, some same attr name (vs file2-g2)
+ * add attr to g2
+ */
write_attr(f1_gid2, 1, attr_dims, "integer1", H5T_NATIVE_INT, f1_attr_idata);
write_attr(f1_gid2, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f1_attr_fdata);
write_attr(f1_gid2, 1, attr_dims, "float3", H5T_NATIVE_FLOAT, f1_attr_fdata);
@@ -1229,9 +1212,9 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
write_attr(f2_gid2, 1, attr_dims, "float2", H5T_NATIVE_FLOAT, f2_attr_fdata);
/*----------------------------------
- * CASE5 - Different attr number, all different attr name
- * add attr to g3
- */
+ * CASE5 - Different attr number, all different attr name
+ * add attr to g3
+ */
write_attr(f1_gid3, 1, attr_dims, "integer10", H5T_NATIVE_INT, f1_attr_idata);
write_attr(f1_gid3, 1, attr_dims, "float11", H5T_NATIVE_FLOAT, f1_attr_fdata);
write_attr(f1_gid3, 1, attr_dims, "float12", H5T_NATIVE_FLOAT, f1_attr_fdata);
@@ -1241,8 +1224,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1 > 0)
H5Fclose(fid1);
if (fid2 > 0)
@@ -1289,16 +1272,16 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
-int test_datasets(const char *file, int make_diffs /* flag to modify data buffers */)
+static int
+test_datasets(const char *file, int make_diffs /* flag to modify data buffers */)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t gid = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hsize_t dims[1] = { 2 };
- herr_t status;
- int buf[2] = { 1, 2 };
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hsize_t dims[1] = {2};
+ herr_t status;
+ int buf[2] = {1, 2};
if (make_diffs > 0)
memset(buf, 0, sizeof buf);
@@ -1308,8 +1291,8 @@ int test_datasets(const char *file, int make_diffs /* flag to modify data buffer
return -1;
/* Create a 1D dataset */
- sid = H5Screate_simple(1, dims, NULL);
- did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
status = H5Sclose(sid);
assert(status >= 0);
@@ -1318,9 +1301,9 @@ int test_datasets(const char *file, int make_diffs /* flag to modify data buffer
gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*-------------------------------------------------------------------------
- * write a series of datasets on the group
- *-------------------------------------------------------------------------
- */
+ * write a series of datasets on the group
+ *-------------------------------------------------------------------------
+ */
write_dset_in(gid, "/dset", fid, make_diffs);
@@ -1342,16 +1325,16 @@ int test_datasets(const char *file, int make_diffs /* flag to modify data buffer
* Purpose: Check datasets with datasapce of zero dimension size.
*-------------------------------------------------------------------------
*/
-static
-int test_special_datasets(const char *file, int make_diffs /* flag to modify data buffers */)
+static int
+test_special_datasets(const char *file, int make_diffs /* flag to modify data buffers */)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t did = H5I_INVALID_HID;
- hid_t sid0 = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hsize_t dims0[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 };
- hsize_t dims[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 };
- herr_t status;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid0 = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hsize_t dims0[SPACE1_RANK] = {SPACE1_DIM1, SPACE1_DIM2};
+ hsize_t dims[SPACE1_RANK] = {SPACE1_DIM1, SPACE1_DIM2};
+ herr_t status;
/* Create a file */
if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -1359,7 +1342,7 @@ int test_special_datasets(const char *file, int make_diffs /* flag to modify dat
/* Create a dataset with zero dimension size */
sid0 = H5Screate_simple(SPACE1_RANK, dims0, NULL);
- did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* close dataset */
status = H5Dclose(did);
@@ -1370,7 +1353,7 @@ int test_special_datasets(const char *file, int make_diffs /* flag to modify dat
assert(status >= 0);
/* Create a dataset with zero dimension size in one file but the other one
- * has a dataset with a non-zero dimension size */
+ * has a dataset with a non-zero dimension size */
if (make_diffs)
dims[1] = SPACE1_DIM2 + 4;
@@ -1399,16 +1382,17 @@ int test_special_datasets(const char *file, int make_diffs /* flag to modify dat
* Programmer: Jonathan Kim (Feb 17, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_link_name(const char *fname1)
+static int
+test_link_name(const char *fname1)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -1417,16 +1401,15 @@ static int test_link_name(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
gid1 = H5Gcreate2(fid1, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
status = FAIL;
goto out;
}
- gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT);
+ gid2 = H5Gcreate2(fid1, "group_longname", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid2 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
@@ -1435,8 +1418,8 @@ static int test_link_name(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Soft Links
- *------------------------------------------------------------------------*/
+ * Soft Links
+ *------------------------------------------------------------------------*/
status = H5Lcreate_soft("group", fid1, "link_g1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
@@ -1453,8 +1436,8 @@ static int test_link_name(const char *fname1)
out:
/*-----------------------------------------------------------------------
- * Close
- *------------------------------------------------------------------------*/
+ * Close
+ *------------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (gid1)
@@ -1472,18 +1455,19 @@ out:
* Programmer: Jonathan Kim (Feb 17, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_soft_links(const char *fname1)
+static int
+test_soft_links(const char *fname1)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -1492,8 +1476,8 @@ static int test_soft_links(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
@@ -1502,8 +1486,8 @@ static int test_soft_links(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -1527,8 +1511,8 @@ static int test_soft_links(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Soft Links
- *------------------------------------------------------------------------*/
+ * Soft Links
+ *------------------------------------------------------------------------*/
/* file 1 */
status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -1574,8 +1558,8 @@ static int test_soft_links(const char *fname1)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (gid1)
@@ -1591,20 +1575,21 @@ out:
* Programmer: Jonathan Kim (Feb 17, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_linked_softlinks(const char *fname1)
+static int
+test_linked_softlinks(const char *fname1)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hid_t gid3 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t gid3 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -1613,8 +1598,8 @@ static int test_linked_softlinks(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
@@ -1637,8 +1622,8 @@ static int test_linked_softlinks(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -1661,10 +1646,10 @@ static int test_linked_softlinks(const char *fname1)
}
/*-----------------------------------------------------------------------
- * Soft Links (Linked)
- *------------------------------------------------------------------------*/
+ * Soft Links (Linked)
+ *------------------------------------------------------------------------*/
/*---------
- * file 1 */
+ * file 1 */
status = H5Lcreate_soft("/target_dset1", fid1, "softlink1_to_dset1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
@@ -1751,8 +1736,8 @@ static int test_linked_softlinks(const char *fname1)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (gid1)
@@ -1772,20 +1757,21 @@ out:
* Programmer: Jonathan Kim (Feb 17, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_external_links(const char *fname1, const char *fname2)
+static int
+test_external_links(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
/* source file */
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
@@ -1803,10 +1789,10 @@ static int test_external_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
/*--------------
- * target file */
+ * target file */
gid1 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
@@ -1821,10 +1807,10 @@ static int test_external_links(const char *fname1, const char *fname2)
goto out;
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/*--------------
- * target file */
+ * target file */
status = write_dset(fid2, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2);
@@ -1847,18 +1833,20 @@ static int test_external_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * External Links
- *------------------------------------------------------------------------*/
+ * External Links
+ *------------------------------------------------------------------------*/
/*--------------*/
/* source file */
- status = H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ status =
+ H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
status = FAIL;
goto out;
}
- status = H5Lcreate_external(fname2, "/target_group2/x_dset", fid1, "ext_link_dset2", H5P_DEFAULT, H5P_DEFAULT);
+ status =
+ H5Lcreate_external(fname2, "/target_group2/x_dset", fid1, "ext_link_dset2", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
status = FAIL;
@@ -1895,8 +1883,8 @@ static int test_external_links(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -1917,19 +1905,20 @@ out:
* Programmer: Jonathan Kim (Feb 17, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_ext2soft_links(const char *fname1, const char *fname2)
+static int
+test_ext2soft_links(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
/* source file */
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
@@ -1947,8 +1936,8 @@ static int test_ext2soft_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
/* target file */
gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid2 < 0) {
@@ -1958,10 +1947,10 @@ static int test_ext2soft_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/*--------------
- * target file */
+ * target file */
status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data2);
if (status == FAIL) {
HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2);
@@ -1977,10 +1966,10 @@ static int test_ext2soft_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Soft Links (Linked)
- *------------------------------------------------------------------------*/
+ * Soft Links (Linked)
+ *------------------------------------------------------------------------*/
/*---------------
- * target file */
+ * target file */
status = H5Lcreate_soft("/dset1", fid2, "softlink_to_dset1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
@@ -1996,10 +1985,10 @@ static int test_ext2soft_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * External Links
- *------------------------------------------------------------------------*/
+ * External Links
+ *------------------------------------------------------------------------*/
/*---------------
- * source file */
+ * source file */
status = H5Lcreate_external(fname2, "/target_group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
@@ -2007,14 +1996,16 @@ static int test_ext2soft_links(const char *fname1, const char *fname2)
goto out;
}
- status = H5Lcreate_external(fname2, "/softlink_to_dset1", fid1, "ext_link_to_slink1", H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Lcreate_external(fname2, "/softlink_to_dset1", fid1, "ext_link_to_slink1", H5P_DEFAULT,
+ H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
status = FAIL;
goto out;
}
- status = H5Lcreate_external(fname2, "/softlink_to_dset2", fid1, "ext_link_to_slink2", H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Lcreate_external(fname2, "/softlink_to_dset2", fid1, "ext_link_to_slink2", H5P_DEFAULT,
+ H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
status = FAIL;
@@ -2023,8 +2014,8 @@ static int test_ext2soft_links(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -2042,18 +2033,19 @@ out:
* Programmer: Jonathan Kim (Feb 17, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_dangle_links(const char *fname1, const char *fname2)
+static int
+test_dangle_links(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ int data2[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -2069,8 +2061,8 @@ static int test_dangle_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -2102,8 +2094,8 @@ static int test_dangle_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Soft Links
- *------------------------------------------------------------------------*/
+ * Soft Links
+ *------------------------------------------------------------------------*/
/* file 1 */
status = H5Lcreate_soft("no_obj", fid1, "soft_link1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2163,8 +2155,8 @@ static int test_dangle_links(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * External Links
- *------------------------------------------------------------------------*/
+ * External Links
+ *------------------------------------------------------------------------*/
/* file1 */
status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2225,8 +2217,8 @@ static int test_dangle_links(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -2242,21 +2234,24 @@ out:
* Programmer: Jonathan Kim (Aug 19, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_group_recurse(const char *fname1, const char *fname2)
+static int
+test_group_recurse(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t gid1_f1 = H5I_INVALID_HID, gid2_f1 = H5I_INVALID_HID, gid3_f1 = H5I_INVALID_HID, gid10_f1 = H5I_INVALID_HID;
- hid_t gid1_f2 = H5I_INVALID_HID, gid2_f2 = H5I_INVALID_HID, gid3_f2 = H5I_INVALID_HID, gid11_f2 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 1 }, { 0, 1 }, { 1, 0 }, { 1, 0 } };
- int data2[4][2] = { { 0, 2 }, { 0, 2 }, { 2, 0 }, { 2, 0 } };
- int data3[4][2] = { { 0, 3 }, { 0, 3 }, { 3, 0 }, { 3, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1_f1 = H5I_INVALID_HID, gid2_f1 = H5I_INVALID_HID, gid3_f1 = H5I_INVALID_HID,
+ gid10_f1 = H5I_INVALID_HID;
+ hid_t gid1_f2 = H5I_INVALID_HID, gid2_f2 = H5I_INVALID_HID, gid3_f2 = H5I_INVALID_HID,
+ gid11_f2 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 1}, {0, 1}, {1, 0}, {1, 0}};
+ int data2[4][2] = {{0, 2}, {0, 2}, {2, 0}, {2, 0}};
+ int data3[4][2] = {{0, 3}, {0, 3}, {3, 0}, {3, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -2272,8 +2267,8 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
/* file1 */
gid1_f1 = H5Gcreate2(fid1, "/grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1_f1 < 0) {
@@ -2333,8 +2328,8 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets under root
- *------------------------------------------------------------------------*/
+ * Datasets under root
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -2380,8 +2375,8 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets under group
- *------------------------------------------------------------------------*/
+ * Datasets under group
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(gid1_f1, 2, dims2, "dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -2493,8 +2488,8 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Soft Links
- *------------------------------------------------------------------------*/
+ * Soft Links
+ *------------------------------------------------------------------------*/
/* file 1 */
status = H5Lcreate_soft("/grp1", fid1, "slink_grp1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2554,8 +2549,8 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * External Links
- *------------------------------------------------------------------------*/
+ * External Links
+ *------------------------------------------------------------------------*/
/* file1 */
status = H5Lcreate_external(fname2, "/grp1", fid1, "elink_grp1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2601,9 +2596,9 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*------------------------------
- * external circle route test
- * file1/grp11 <-> file2/grp10 via elink_grp_circle link
- */
+ * external circle route test
+ * file1/grp11 <-> file2/grp10 via elink_grp_circle link
+ */
/* file1 */
status = H5Lcreate_external(fname2, "/grp11", gid10_f1, "elink_grp_circle", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2621,8 +2616,8 @@ static int test_group_recurse(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -2654,38 +2649,39 @@ out:
*-------------------------------------------------------------------------*/
#define GRP_R_DSETNAME1 "dset1"
#define GRP_R_DSETNAME2 "dset2"
-static int test_group_recurse2(void)
+static int
+test_group_recurse2(void)
{
- hid_t fileid1 = H5I_INVALID_HID;
- hid_t grp1 = H5I_INVALID_HID;
- hid_t grp2 = H5I_INVALID_HID;
- hid_t grp3 = H5I_INVALID_HID;
- hid_t grp4 = H5I_INVALID_HID;
- hid_t dset1 = H5I_INVALID_HID;
- hid_t dset2 = H5I_INVALID_HID;
- hid_t datatype = H5I_INVALID_HID;
- hid_t dataspace = H5I_INVALID_HID;
- hid_t fileid2 = H5I_INVALID_HID;
- hid_t fileid3 = H5I_INVALID_HID;
- hid_t fileid4 = H5I_INVALID_HID;
+ hid_t fileid1 = H5I_INVALID_HID;
+ hid_t grp1 = H5I_INVALID_HID;
+ hid_t grp2 = H5I_INVALID_HID;
+ hid_t grp3 = H5I_INVALID_HID;
+ hid_t grp4 = H5I_INVALID_HID;
+ hid_t dset1 = H5I_INVALID_HID;
+ hid_t dset2 = H5I_INVALID_HID;
+ hid_t datatype = H5I_INVALID_HID;
+ hid_t dataspace = H5I_INVALID_HID;
+ hid_t fileid2 = H5I_INVALID_HID;
+ hid_t fileid3 = H5I_INVALID_HID;
+ hid_t fileid4 = H5I_INVALID_HID;
hsize_t dimsf[2]; /* dataset dimensions */
- herr_t status = 0;
- int data1[4][2] = { { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 } };
- int data2[4][2] = { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 3, 3 } };
+ herr_t status = 0;
+ int data1[4][2] = {{0, 0}, {1, 1}, {2, 2}, {3, 3}};
+ int data2[4][2] = {{0, 0}, {0, 1}, {0, 2}, {3, 3}};
/*-----------------------------------------------------------------------
- * FILE 1
- *------------------------------------------------------------------------*/
+ * FILE 1
+ *------------------------------------------------------------------------*/
/*
- * Create a new file using H5F_ACC_TRUNC access,
- * default file creation properties, and default file
- * access properties.
- */
+ * Create a new file using H5F_ACC_TRUNC access,
+ * default file creation properties, and default file
+ * access properties.
+ */
fileid1 = H5Fcreate(GRP_RECURSE1_EXT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
grp1 = H5Gcreate2(fileid1, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (grp1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT);
@@ -2715,72 +2711,72 @@ static int test_group_recurse2(void)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/*
- * Describe the size of the array and create the data space for fixed
- * size dataset.
- */
- dimsf[0] = 4;
- dimsf[1] = 2;
+ * Describe the size of the array and create the data space for fixed
+ * size dataset.
+ */
+ dimsf[0] = 4;
+ dimsf[1] = 2;
dataspace = H5Screate_simple(2, dimsf, NULL);
/*
- * Define datatype for the data in the file.
- * We will store little endian INT numbers.
- */
+ * Define datatype for the data in the file.
+ * We will store little endian INT numbers.
+ */
datatype = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tset_order(datatype, H5T_ORDER_LE);
+ status = H5Tset_order(datatype, H5T_ORDER_LE);
/*---------------
- * dset1
- */
+ * dset1
+ */
/*
- * Create a new dataset within the file using defined dataspace and
- * datatype and default dataset creation properties.
- */
+ * Create a new dataset within the file using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
dset1 = H5Dcreate2(fileid1, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
- * Write the data to the dataset using default transfer properties.
- */
+ * Write the data to the dataset using default transfer properties.
+ */
status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
H5Dclose(dset1);
/*---------------
- * dset1
- */
+ * dset1
+ */
/*
- * Create a new dataset within the file using defined dataspace and
- * datatype and default dataset creation properties.
- */
+ * Create a new dataset within the file using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
- * Write the data to the dataset using default transfer properties.
- */
+ * Write the data to the dataset using default transfer properties.
+ */
status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
/*---------------
- * dset2
- */
+ * dset2
+ */
/*
- * Create a new dataset within the fileid1 using defined dataspace and
- * datatype and default dataset creation properties.
- */
+ * Create a new dataset within the fileid1 using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
- * Write the data to the dataset using default transfer properties.
- */
+ * Write the data to the dataset using default transfer properties.
+ */
status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
/*-----------------------------------------------------------------------
- * Soft links
- *------------------------------------------------------------------------*/
+ * Soft links
+ *------------------------------------------------------------------------*/
/*
- * under '/' root
- */
+ * under '/' root
+ */
/* link to dset1 */
status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2797,15 +2793,15 @@ static int test_group_recurse2(void)
H5Gclose(grp4);
/*-----------------------------------------------------------------------
- * FILE 2-3
- *------------------------------------------------------------------------*/
+ * FILE 2-3
+ *------------------------------------------------------------------------*/
/* crate target file */
fileid4 = H5Fcreate(GRP_RECURSE2_EXT3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------
- * Groups
- */
+ * Groups
+ */
grp4 = H5Gcreate2(fileid4, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (grp4 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT3);
@@ -2814,32 +2810,32 @@ static int test_group_recurse2(void)
}
/*---------------
- * dset2
- */
+ * dset2
+ */
/*
- * Create a new dataset within the fileid1 using defined dataspace and
- * datatype and default dataset creation properties.
- */
+ * Create a new dataset within the fileid1 using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
dset2 = H5Dcreate2(grp4, GRP_R_DSETNAME2, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
- * Write the data to the dataset using default transfer properties.
- */
+ * Write the data to the dataset using default transfer properties.
+ */
status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
H5Gclose(grp4);
H5Dclose(dset2);
/*-----------------------------------------------------------------------
- * FILE 2-2
- *------------------------------------------------------------------------*/
+ * FILE 2-2
+ *------------------------------------------------------------------------*/
/* crate target file */
fileid3 = H5Fcreate(GRP_RECURSE2_EXT2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------
- * Groups
- */
+ * Groups
+ */
grp2 = H5Gcreate2(fileid3, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (grp2 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2);
@@ -2855,22 +2851,22 @@ static int test_group_recurse2(void)
}
/*---------------
- * dset1
- */
+ * dset1
+ */
/*
- * Create a new dataset within the fileid1 using defined dataspace and
- * datatype and default dataset creation properties.
- */
+ * Create a new dataset within the fileid1 using defined dataspace and
+ * datatype and default dataset creation properties.
+ */
dset1 = H5Dcreate2(grp3, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
- * Write the data to the dataset using default transfer properties.
- */
+ * Write the data to the dataset using default transfer properties.
+ */
status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
/*-----------------------------------------------
- * extlink to $GRP_RECURSE2_EXT3/g4
- */
+ * extlink to $GRP_RECURSE2_EXT3/g4
+ */
status = H5Lcreate_external(GRP_RECURSE2_EXT3, "/g4", fileid3, "/g2/g3/g4", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT2);
@@ -2883,15 +2879,15 @@ static int test_group_recurse2(void)
H5Gclose(grp3);
/*-----------------------------------------------------------------------
- * FILE 2-1
- *------------------------------------------------------------------------*/
+ * FILE 2-1
+ *------------------------------------------------------------------------*/
/* crate target file */
fileid2 = H5Fcreate(GRP_RECURSE2_EXT1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------
- * Groups
- */
+ * Groups
+ */
grp1 = H5Gcreate2(fileid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (grp1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT);
@@ -2900,21 +2896,21 @@ static int test_group_recurse2(void)
}
/*---------------
- * dset1
- */
+ * dset1
+ */
dset1 = H5Dcreate2(fileid2, GRP_R_DSETNAME1, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
- * Write the data to the dataset using default transfer properties.
- */
+ * Write the data to the dataset using default transfer properties.
+ */
status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
/*-----------------------------------------------------------------------
- * Soft links
- *------------------------------------------------------------------------*/
+ * Soft links
+ *------------------------------------------------------------------------*/
/*
- * under '/' root
- */
+ * under '/' root
+ */
/* link to dset1 */
status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid2, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
@@ -2924,8 +2920,8 @@ static int test_group_recurse2(void)
}
/*-----------------------------------------------
- * extlink to $GRP_RECURSE2_EXT2/g2
- */
+ * extlink to $GRP_RECURSE2_EXT2/g2
+ */
status = H5Lcreate_external(GRP_RECURSE2_EXT2, "/g2", fileid2, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT1);
@@ -2938,8 +2934,8 @@ static int test_group_recurse2(void)
out:
/*
- * Close/release resources.
- */
+ * Close/release resources.
+ */
if (dataspace > 0)
H5Sclose(dataspace);
if (datatype > 0)
@@ -2965,20 +2961,21 @@ out:
* Programmer: Jonathan Kim (July, 21, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_exclude_obj1(const char *fname1, const char *fname2)
+static int
+test_exclude_obj1(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ int data2[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -2994,8 +2991,8 @@ static int test_exclude_obj1(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Group
- *------------------------------------------------------------------------*/
+ * Group
+ *------------------------------------------------------------------------*/
/* file1 */
gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
@@ -3014,8 +3011,8 @@ static int test_exclude_obj1(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -3062,8 +3059,8 @@ static int test_exclude_obj1(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -3085,21 +3082,22 @@ out:
* Programmer: Jonathan Kim (July, 21, 2010)
*
*-------------------------------------------------------------------------*/
-static int test_exclude_obj2(const char *fname1, const char *fname2)
+static int
+test_exclude_obj2(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hid_t gid3 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t gid3 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ int data2[4][2] = {{0, 1}, {2, 3}, {1, 2}, {3, 4}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -3115,8 +3113,8 @@ static int test_exclude_obj2(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Group
- *------------------------------------------------------------------------*/
+ * Group
+ *------------------------------------------------------------------------*/
/* file1 */
gid1 = H5Gcreate2(fid1, "group10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
@@ -3143,8 +3141,8 @@ static int test_exclude_obj2(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "dset10", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -3191,8 +3189,8 @@ static int test_exclude_obj2(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -3216,18 +3214,19 @@ out:
* Programmer: Jonathan Kim (Mar, 19, 2012)
*
*-------------------------------------------------------------------------*/
-static int test_exclude_obj3(const char *fname1, const char *fname2)
+static int
+test_exclude_obj3(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hsize_t dims2[2] = { 2, 4 };
- int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- herr_t status = SUCCEED;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hsize_t dims2[2] = {2, 4};
+ int data1[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
@@ -3243,8 +3242,8 @@ static int test_exclude_obj3(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Group
- *------------------------------------------------------------------------*/
+ * Group
+ *------------------------------------------------------------------------*/
/* file1 */
gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
@@ -3254,8 +3253,8 @@ static int test_exclude_obj3(const char *fname1, const char *fname2)
}
/*-----------------------------------------------------------------------
- * Datasets
- *------------------------------------------------------------------------*/
+ * Datasets
+ *------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1);
if (status == FAIL) {
@@ -3281,8 +3280,8 @@ static int test_exclude_obj3(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -3302,182 +3301,181 @@ out:
* Programmer: Jonathan Kim (Oct, 26, 2010)
*
*-------------------------------------------------------------------------*/
-#define STR_RANK 1
-#define VLEN_STR_DIM 1
-#define FIXLEN_STR_SIZE 21
-#define FIXLEN_STR_DIM 1
-#define VLEN_STR_ARRY_DIM 3
-#define FIXLEN_STR_ARRY_DIM 3
+#define STR_RANK 1
+#define VLEN_STR_DIM 1
+#define FIXLEN_STR_SIZE 21
+#define FIXLEN_STR_DIM 1
+#define VLEN_STR_ARRY_DIM 3
+#define FIXLEN_STR_ARRY_DIM 3
#define FIXLEN_STR_ARRY_SIZE 30
-#define COMP_RANK 1
-#define COMP_DIM 1
-static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new)
+#define COMP_RANK 1
+#define COMP_DIM 1
+static int
+test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new)
{
- int i;
+ int i;
hid_t fid1 = H5I_INVALID_HID; /* file id */
- hid_t gid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
/* compound1 datatype */
typedef struct comp1_t {
- char *str_vlen; /* vlen string */
- char *str_vlen_repeat; /* vlen string */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char * str_vlen; /* vlen string */
+ char * str_vlen_repeat; /* vlen string */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
} comp1_t;
/* compound2 datatype */
typedef struct comp2_t {
- char *str_vlen; /* vlen string */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen_repeat; /* vlen string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char * str_vlen; /* vlen string */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char * str_vlen_repeat; /* vlen string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
} comp2_t;
/* compound3 datatype */
typedef struct comp3_t {
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen; /* vlen string */
- char *str_vlen_repeat; /* vlen string */
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_vlen; /* vlen string */
+ char *str_vlen_repeat; /* vlen string */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
} comp3_t;
/* compound4 datatype */
typedef struct comp4_t {
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen; /* vlen string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen_repeat; /* vlen string */
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char * str_vlen; /* vlen string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char * str_vlen_repeat; /* vlen string */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
} comp4_t;
/* compound5 datatype */
typedef struct comp5_t {
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- char *str_vlen; /* vlen string */
- char *str_vlen_repeat; /* vlen string */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_vlen; /* vlen string */
+ char *str_vlen_repeat; /* vlen string */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
} comp5_t;
/* compound6 datatype */
typedef struct comp6_t {
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- char *str_vlen; /* vlen string */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen_repeat; /* vlen string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char *str_vlen; /* vlen string */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char *str_vlen_repeat; /* vlen string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
} comp6_t;
/* compound7 datatype */
typedef struct comp7_t {
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen; /* vlen string */
- char *str_vlen_repeat; /* vlen string */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char * str_vlen; /* vlen string */
+ char * str_vlen_repeat; /* vlen string */
} comp7_t;
/* compound8 datatype */
typedef struct comp8_t {
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen; /* vlen string */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- char *str_vlen_repeat; /* vlen string */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ char * str_vlen; /* vlen string */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ char * str_vlen_repeat; /* vlen string */
} comp8_t;
/* compound9 datatype */
typedef struct comp9_t {
- char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
+ char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */
- const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
- const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
- char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
- int int_data1;
- hobj_ref_t objref1; /* reference */
- char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
- hobj_ref_t objref2; /* reference */
- char *str_vlen; /* vlen string */
- int int_data2;
- char *str_vlen_repeat; /* vlen string */
- hobj_ref_t objref3; /* reference */
- int int_data3;
+ const char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ const char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */
+ char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */
+ int int_data1;
+ hobj_ref_t objref1; /* reference */
+ char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */
+ hobj_ref_t objref2; /* reference */
+ char * str_vlen; /* vlen string */
+ int int_data2;
+ char * str_vlen_repeat; /* vlen string */
+ hobj_ref_t objref3; /* reference */
+ int int_data3;
} comp9_t;
/* vlen string */
- hid_t sid_vlen_str = H5I_INVALID_HID; /* dataspace ID */
- hid_t tid_vlen_str = H5I_INVALID_HID; /* datatype ID */
- char vlen_str_buf[] = { "Variable length string" };
- hsize_t dims_vlen_str[] = { VLEN_STR_DIM };
+ hid_t sid_vlen_str = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid_vlen_str = H5I_INVALID_HID; /* datatype ID */
+ char vlen_str_buf[] = {"Variable length string"};
+ hsize_t dims_vlen_str[] = {VLEN_STR_DIM};
/* fixlen string */
- hid_t sid_fixlen_str = H5I_INVALID_HID; /* dataspace ID */
- hid_t tid_fixlen_str = H5I_INVALID_HID; /* datatype ID */
- const char fixlen_str_buf[FIXLEN_STR_SIZE] = { "Fixed length string" };
- hsize_t dims_fixlen_str[] = { FIXLEN_STR_DIM };
+ hid_t sid_fixlen_str = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid_fixlen_str = H5I_INVALID_HID; /* datatype ID */
+ const char fixlen_str_buf[FIXLEN_STR_SIZE] = {"Fixed length string"};
+ hsize_t dims_fixlen_str[] = {FIXLEN_STR_DIM};
/* vlen string array */
- hid_t sid_vlen_str_array = H5I_INVALID_HID; /* dataspace ID */
- hid_t tid_vlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */
- hid_t tid_vlen_str_array = H5I_INVALID_HID; /* datatype ID */
- const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM] =
- { "1 - Variable length string Array",
- "2 - Testing variable length string array in compound type",
- "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation," };
- hsize_t dims_vlen_str_array[] = { VLEN_STR_ARRY_DIM };
+ hid_t sid_vlen_str_array = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid_vlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid_vlen_str_array = H5I_INVALID_HID; /* datatype ID */
+ const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM] = {
+ "1 - Variable length string Array", "2 - Testing variable length string array in compound type",
+ "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation,"};
+ hsize_t dims_vlen_str_array[] = {VLEN_STR_ARRY_DIM};
/* fixlen string array */
- hid_t sid_fixlen_str_array = H5I_INVALID_HID; /* dataspace ID */
- hid_t tid_fixlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */
- hid_t tid_fixlen_str_array = H5I_INVALID_HID; /* datatype ID */
+ hid_t sid_fixlen_str_array = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid_fixlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid_fixlen_str_array = H5I_INVALID_HID; /* datatype ID */
const char *fixlen_str_array_buf[FIXLEN_STR_ARRY_DIM] = {
- "1 - Fixed length string Array", "2 - Fixed length string Array",
- "3 - Fixed length string Array" };
- hsize_t dims_fixlen_str_array[] = { FIXLEN_STR_ARRY_DIM };
+ "1 - Fixed length string Array", "2 - Fixed length string Array", "3 - Fixed length string Array"};
+ hsize_t dims_fixlen_str_array[] = {FIXLEN_STR_ARRY_DIM};
/*------------------------------------------
- * compound dataset
- *------------------------------------------*/
- hid_t sid_comp = H5I_INVALID_HID; /* dataspace ID */
- hid_t tid1_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid2_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid3_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid4_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid5_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid6_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid7_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid8_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t tid9_comp = H5I_INVALID_HID; /* datatype ID */
- hid_t did_comp = H5I_INVALID_HID; /* dataset ID */
- hsize_t dims_comp[] = { COMP_DIM };
- herr_t status = SUCCEED;
+ * compound dataset
+ *------------------------------------------*/
+ hid_t sid_comp = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid1_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid2_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid3_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid4_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid5_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid6_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid7_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid8_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid9_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t did_comp = H5I_INVALID_HID; /* dataset ID */
+ hsize_t dims_comp[] = {COMP_DIM};
+ herr_t status = SUCCEED;
/* make compound strings data */
comp1_t comp1_buf;
@@ -3534,25 +3532,15 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* copy vlen string array data to compound buffers */
for (i = 0; i < VLEN_STR_ARRY_DIM; i++) {
- comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
- comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] =
- vlen_str_array_buf[i];
-
+ comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
+ comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] = vlen_str_array_buf[i];
}
/* copy fixlen string attay data to compound buffers */
@@ -3591,8 +3579,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
comp9_buf.int_data3 = 30;
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
if (is_file_new == 1) {
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
@@ -3611,8 +3599,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-----------------------------------------------------------------------
- * Create group
- *------------------------------------------------------------------------*/
+ * Create group
+ *------------------------------------------------------------------------*/
gid = H5Gcreate2(fid1, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
@@ -3621,8 +3609,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-----------------------------------------------------------------------
- * Variable length String1 - Create space and type
- *------------------------------------------------------------------------*/
+ * Variable length String1 - Create space and type
+ *------------------------------------------------------------------------*/
sid_vlen_str = H5Screate_simple(STR_RANK, dims_vlen_str, NULL);
if (sid_vlen_str < 0) {
HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
@@ -3631,7 +3619,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
tid_vlen_str = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid_vlen_str, H5T_VARIABLE);
+ status = H5Tset_size(tid_vlen_str, H5T_VARIABLE);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1);
status = FAIL;
@@ -3639,8 +3627,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-----------------------------------------------------------------------
- * Fixed length String2 - Create space and type
- *------------------------------------------------------------------------*/
+ * Fixed length String2 - Create space and type
+ *------------------------------------------------------------------------*/
sid_fixlen_str = H5Screate_simple(STR_RANK, dims_fixlen_str, NULL);
if (sid_fixlen_str < 0) {
HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
@@ -3649,7 +3637,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
tid_fixlen_str = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid_fixlen_str, FIXLEN_STR_SIZE);
+ status = H5Tset_size(tid_fixlen_str, FIXLEN_STR_SIZE);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1);
status = FAIL;
@@ -3657,8 +3645,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-----------------------------------------------------------------------
- * Fixed length String3 array - Create space and type
- *------------------------------------------------------------------------*/
+ * Fixed length String3 array - Create space and type
+ *------------------------------------------------------------------------*/
sid_vlen_str_array = H5Screate_simple(STR_RANK, dims_vlen_str_array, NULL);
if (sid_vlen_str_array < 0) {
HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
@@ -3667,7 +3655,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
tid_vlen_str_array_pre = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid_vlen_str_array_pre, H5T_VARIABLE);
+ status = H5Tset_size(tid_vlen_str_array_pre, H5T_VARIABLE);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1);
status = FAIL;
@@ -3683,8 +3671,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-----------------------------------------------------------------------
- * Variable length String4 array - Create space and type
- *------------------------------------------------------------------------*/
+ * Variable length String4 array - Create space and type
+ *------------------------------------------------------------------------*/
sid_fixlen_str_array = H5Screate_simple(STR_RANK, dims_fixlen_str_array, NULL);
if (sid_fixlen_str_array < 0) {
HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
@@ -3693,7 +3681,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
tid_fixlen_str_array_pre = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid_fixlen_str_array_pre, FIXLEN_STR_ARRY_SIZE);
+ status = H5Tset_size(tid_fixlen_str_array_pre, FIXLEN_STR_ARRY_SIZE);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1);
status = FAIL;
@@ -3708,8 +3696,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-------------------------------------------------------------------------
- * Compound dataset
- *------------------------------------------------------------------------*/
+ * Compound dataset
+ *------------------------------------------------------------------------*/
sid_comp = H5Screate_simple(COMP_RANK, dims_comp, NULL);
if (sid_comp < 0) {
HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1);
@@ -3772,7 +3760,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
H5Tinsert(tid5_comp, "FIXLEN_STR1", HOFFSET(comp5_t, str_fixlen), tid_fixlen_str);
H5Tinsert(tid5_comp, "FIXLEN_STR2", HOFFSET(comp5_t, str_fixlen_repeat), tid_fixlen_str);
H5Tinsert(tid5_comp, "VLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_vlen), tid_vlen_str_array);
- H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array);
+ H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array);
H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_fixlen), tid_fixlen_str_array);
H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp5_t, str_fixlen_array_again), tid_fixlen_str_array);
@@ -3824,7 +3812,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 1 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset1", tid1_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid1_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp1_buf);
+ status = H5Dwrite(did_comp, tid1_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp1_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3834,7 +3822,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 2 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset2", tid2_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid2_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp2_buf);
+ status = H5Dwrite(did_comp, tid2_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp2_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3844,7 +3832,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 3 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset3", tid3_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid3_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp3_buf);
+ status = H5Dwrite(did_comp, tid3_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp3_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3854,7 +3842,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 4 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset4", tid4_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid4_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp4_buf);
+ status = H5Dwrite(did_comp, tid4_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp4_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3864,7 +3852,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 5 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset5", tid5_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid5_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp5_buf);
+ status = H5Dwrite(did_comp, tid5_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp5_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3874,7 +3862,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 6 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset6", tid6_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid6_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp6_buf);
+ status = H5Dwrite(did_comp, tid6_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp6_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3884,7 +3872,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 7 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset7", tid7_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid7_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp7_buf);
+ status = H5Dwrite(did_comp, tid7_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp7_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3894,7 +3882,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* Write data to compound 8 dataset buffer */
did_comp = H5Dcreate2(gid, "Compound_dset8", tid8_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- status = H5Dwrite(did_comp, tid8_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp8_buf);
+ status = H5Dwrite(did_comp, tid8_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp8_buf);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
@@ -3906,9 +3894,9 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
did_comp = H5Dcreate2(gid, "Compound_dset9", tid9_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* obj references */
- status = H5Rcreate(&(comp9_buf.objref1), gid, "Compound_dset2", H5R_OBJECT, (hid_t) -1);
- status = H5Rcreate(&(comp9_buf.objref2), gid, "Compound_dset3", H5R_OBJECT, (hid_t) -1);
- status = H5Rcreate(&(comp9_buf.objref3), gid, "Compound_dset4", H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&(comp9_buf.objref1), gid, "Compound_dset2", H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&(comp9_buf.objref2), gid, "Compound_dset3", H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&(comp9_buf.objref3), gid, "Compound_dset4", H5R_OBJECT, (hid_t)-1);
status = H5Dwrite(did_comp, tid9_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp9_buf);
if (status < 0) {
@@ -3922,8 +3910,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
out:
/*-----------------------------------------------------------------------
- * Close
- *-----------------------------------------------------------------------*/
+ * Close
+ *-----------------------------------------------------------------------*/
if (fid1 > 0)
H5Fclose(fid1);
if (gid > 0)
@@ -3987,59 +3975,60 @@ out:
*
*-------------------------------------------------------------------------*/
-static int test_enums(const char *fname)
+static int
+test_enums(const char *fname)
{
hid_t fid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
- int enum_val = -1;
+ hid_t tid = H5I_INVALID_HID;
+ int enum_val = -1;
/* The data in the two arrays cover the following cases:
- *
- * V = valid enum value, I = invalid enum value
- *
- * 0: I-I (same value)
- * 1: V-I
- * 2: I-V
- * 3: V-V (same value)
- * 4: I-I (different values) SKIPPED FOR NOW
- * 5: V-V (different values)
- */
+ *
+ * V = valid enum value, I = invalid enum value
+ *
+ * 0: I-I (same value)
+ * 1: V-I
+ * 2: I-V
+ * 3: V-V (same value)
+ * 4: I-I (different values) SKIPPED FOR NOW
+ * 5: V-V (different values)
+ */
/* *** NOTE ***
- *
- * There is a bug in H5Dread() where invalid enum values are always
- * returned as -1 so two different invalid enum values cannot be
- * properly compared. Test 4 has been adjusted to pass here
- * while we fix the issue.
- */
- int data1[6] = { 9, 0, 9, 0, 9, 0 };
+ *
+ * There is a bug in H5Dread() where invalid enum values are always
+ * returned as -1 so two different invalid enum values cannot be
+ * properly compared. Test 4 has been adjusted to pass here
+ * while we fix the issue.
+ */
+ int data1[6] = {9, 0, 9, 0, 9, 0};
/*int data1[6] = {9, 0, 9, 0, 8, 0}; */
- int data2[6] = { 9, 9, 0, 0, 9, 1 };
+ int data2[6] = {9, 9, 0, 0, 9, 1};
hsize_t dims = 6;
herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
- * Create the file
- *---------------------------------------------------------------------*/
+ * Create the file
+ *---------------------------------------------------------------------*/
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------------------------------
- * Create enum types
- *---------------------------------------------------------------------*/
+ * Create enum types
+ *---------------------------------------------------------------------*/
- tid = H5Tenum_create(H5T_NATIVE_INT);
+ tid = H5Tenum_create(H5T_NATIVE_INT);
enum_val = 0;
- status = H5Tenum_insert(tid, "YIN", &enum_val);
+ status = H5Tenum_insert(tid, "YIN", &enum_val);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname);
status = FAIL;
goto out;
}
enum_val = 1;
- status = H5Tenum_insert(tid, "YANG", &enum_val);
+ status = H5Tenum_insert(tid, "YANG", &enum_val);
if (status < 0) {
HDfprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname);
status = FAIL;
@@ -4047,8 +4036,8 @@ static int test_enums(const char *fname)
}
/*-----------------------------------------------------------------------
- * Create datasets containing enum data.
- *---------------------------------------------------------------------*/
+ * Create datasets containing enum data.
+ *---------------------------------------------------------------------*/
status = write_dset(fid, 1, &dims, "dset1", tid, data1);
if (status < 0) {
@@ -4065,8 +4054,8 @@ static int test_enums(const char *fname)
out:
/*-----------------------------------------------------------------------
- * Close
- *---------------------------------------------------------------------*/
+ * Close
+ *---------------------------------------------------------------------*/
if (fid)
H5Fclose(fid);
if (tid)
@@ -4096,56 +4085,57 @@ out:
* Programmer: Jonathan Kim (Sep, 1, 2011)
*
*-------------------------------------------------------------------------*/
-#define SDIM_DSET 2
+#define SDIM_DSET 2
#define SDIM_CMPD_ARRAY 2
-static void test_comps_array(const char *fname, const char *dset, const char *attr, int diff, int is_file_new)
+static void
+test_comps_array(const char *fname, const char *dset, const char *attr, int diff, int is_file_new)
{
/* sub compound 2 */
typedef struct {
- int i2;
+ int i2;
float f2;
} cmpd2_t;
/* top compound 1 */
typedef struct {
- int i1;
+ int i1;
cmpd2_t cmpd2[SDIM_CMPD_ARRAY];
} cmpd1_t;
cmpd1_t wdata[SDIM_DSET]; /* dataset with compound1 */
- hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */
- hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */
- hid_t sid_dset = H5I_INVALID_HID; /* Dataset space ID */
- hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 type ID */
- hid_t tid_arry1 = H5I_INVALID_HID; /* Array type ID in compound1 */
- hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 type ID */
- hid_t tid_attr = H5I_INVALID_HID;
- hsize_t sdims_dset[] = { SDIM_DSET };
- hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY };
- int i, j;
- herr_t ret; /* Generic return value */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */
+ hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t sid_dset = H5I_INVALID_HID; /* Dataset space ID */
+ hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 type ID */
+ hid_t tid_arry1 = H5I_INVALID_HID; /* Array type ID in compound1 */
+ hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 type ID */
+ hid_t tid_attr = H5I_INVALID_HID;
+ hsize_t sdims_dset[] = {SDIM_DSET};
+ hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY};
+ int i, j;
+ herr_t ret; /* Generic return value */
/* Initialize array data to write */
for (i = 0; i < SDIM_DSET; i++) {
wdata[i].i1 = i;
for (j = 0; j < SDIM_CMPD_ARRAY; j++) {
wdata[i].cmpd2[j].i2 = i * 10 + diff;
- wdata[i].cmpd2[j].f2 = (float) i * 10.5F + (float) diff;
+ wdata[i].cmpd2[j].f2 = (float)i * 10.5F + (float)diff;
} /* end for */
}
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
if (is_file_new == 1)
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
else
fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
/* -------------------------------
- * Create a sub compound2 datatype */
+ * Create a sub compound2 datatype */
tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t));
/* Insert integer field */
@@ -4157,8 +4147,8 @@ static void test_comps_array(const char *fname, const char *dset, const char *at
assert(ret >= 0);
/*-----------------------------------
- * Create a top compound1.
- */
+ * Create a top compound1.
+ */
tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t));
ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT);
@@ -4171,8 +4161,8 @@ static void test_comps_array(const char *fname, const char *dset, const char *at
assert(ret >= 0);
/* -------------------
- * Create a dataset
- */
+ * Create a dataset
+ */
/* Create dataspace for datasets */
sid_dset = H5Screate_simple(1, sdims_dset, NULL);
@@ -4183,15 +4173,15 @@ static void test_comps_array(const char *fname, const char *dset, const char *at
assert(ret >= 0);
/*-----------------------------------
- * Create an attribute in root group
- */
+ * Create an attribute in root group
+ */
tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT);
assert(tid_attr > 0);
ret = H5Awrite(tid_attr, tid_cmpd1, wdata);
assert(ret >= 0);
/* ----------------
- * Close Dataset */
+ * Close Dataset */
ret = H5Aclose(tid_attr);
assert(ret >= 0);
ret = H5Tclose(tid_arry1);
@@ -4208,57 +4198,56 @@ static void test_comps_array(const char *fname, const char *dset, const char *at
assert(ret >= 0);
}
-static void test_comps_vlen(const char * fname, const char *dset, const char *attr, int diff, int is_file_new)
+static void
+test_comps_vlen(const char *fname, const char *dset, const char *attr, int diff, int is_file_new)
{
/* sub compound 2 */
typedef struct {
- int i2;
+ int i2;
float f2;
} cmpd2_t;
/* top compound 1 */
typedef struct {
- int i1;
+ int i1;
hvl_t vl; /* VL information for compound2 */
} cmpd1_t;
cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */
- hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */
- hid_t did_dset = H5I_INVALID_HID; /* dataset ID */
- hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */
- hid_t tid_attr = H5I_INVALID_HID;
- hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */
- hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */
- hid_t tid_cmpd1_vlen = H5I_INVALID_HID;
- hsize_t sdims_dset[] = { SDIM_DSET };
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */
+ hid_t did_dset = H5I_INVALID_HID; /* dataset ID */
+ hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */
+ hid_t tid_attr = H5I_INVALID_HID;
+ hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */
+ hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */
+ hid_t tid_cmpd1_vlen = H5I_INVALID_HID;
+ hsize_t sdims_dset[] = {SDIM_DSET};
unsigned i, j; /* counting variables */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Allocate and initialize VL data to write */
for (i = 0; i < SDIM_DSET; i++) {
- wdata[i].i1 = (int) i;
- wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
+ wdata[i].i1 = (int)i;
+ wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
wdata[i].vl.len = i + 1;
for (j = 0; j < (i + 1); j++) {
- ((cmpd2_t *) wdata[i].vl.p)[j].i2 =
- (int) (i * 10 + (unsigned) diff);
- ((cmpd2_t *) wdata[i].vl.p)[j].f2 = (float) i * 10.5F
- + (float) diff;
+ ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)(i * 10 + (unsigned)diff);
+ ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)i * 10.5F + (float)diff;
} /* end for */
- } /* end for */
+ } /* end for */
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
if (is_file_new == 1)
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
else
fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
/* -----------------------------
- * Create sub compound2 type */
+ * Create sub compound2 type */
tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t));
/* Insert fields */
@@ -4268,7 +4257,7 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at
assert(ret >= 0);
/* ---------------------------
- * Create top compound1 type */
+ * Create top compound1 type */
tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t));
/* Insert fields */
ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT);
@@ -4280,8 +4269,8 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at
assert(ret >= 0);
/* -------------------------------
- * Create dataset with compound1
- */
+ * Create dataset with compound1
+ */
/* Create dataspace for dataset */
sid_dset = H5Screate_simple(1, sdims_dset, NULL);
@@ -4293,8 +4282,8 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at
assert(ret >= 0);
/*-----------------------------------
- * Create an attribute in root group
- */
+ * Create an attribute in root group
+ */
tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT);
assert(tid_attr > 0);
ret = H5Awrite(tid_attr, tid_cmpd1, wdata);
@@ -4305,7 +4294,7 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at
assert(ret >= 0);
/* ----------------
- * Close IDs */
+ * Close IDs */
ret = H5Aclose(tid_attr);
assert(ret >= 0);
ret = H5Dclose(did_dset);
@@ -4322,60 +4311,59 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at
assert(ret >= 0);
}
-static void test_comps_array_vlen(const char * fname, const char *dset, const char *attr, int diff, int is_file_new)
+static void
+test_comps_array_vlen(const char *fname, const char *dset, const char *attr, int diff, int is_file_new)
{
typedef struct {
- int i3;
+ int i3;
float f3;
} cmpd3_t;
typedef struct { /* Typedef for compound datatype */
- int i2;
+ int i2;
hvl_t vl; /* VL information to write */
} cmpd2_t;
typedef struct {
- int i1;
+ int i1;
cmpd2_t cmpd2[SDIM_CMPD_ARRAY];
} cmpd1_t;
- cmpd1_t wdata[SDIM_DSET]; /* Information to write */
- hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */
- hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */
- hid_t sid_dset = H5I_INVALID_HID; /* Dataspace ID */
- hid_t tid_attr = H5I_INVALID_HID;
- hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 Datatype ID */
- hid_t tid_arry1 = H5I_INVALID_HID; /* Array Datatype ID */
- hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 Datatype ID */
- hid_t tid_cmpd2_vlen = H5I_INVALID_HID;
- hid_t tid_cmpd3 = H5I_INVALID_HID; /* Compound3 Datatype ID */
- hsize_t sdims_dset[] = { SDIM_DSET };
- hsize_t sdims_arry[] = { SDIM_CMPD_ARRAY };
+ cmpd1_t wdata[SDIM_DSET]; /* Information to write */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */
+ hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t sid_dset = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t tid_attr = H5I_INVALID_HID;
+ hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 Datatype ID */
+ hid_t tid_arry1 = H5I_INVALID_HID; /* Array Datatype ID */
+ hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 Datatype ID */
+ hid_t tid_cmpd2_vlen = H5I_INVALID_HID;
+ hid_t tid_cmpd3 = H5I_INVALID_HID; /* Compound3 Datatype ID */
+ hsize_t sdims_dset[] = {SDIM_DSET};
+ hsize_t sdims_arry[] = {SDIM_CMPD_ARRAY};
unsigned i, j, k; /* counting variables */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Initialize array data to write in compound1 */
for (i = 0; i < SDIM_DSET; i++) {
- wdata[i].i1 = (int) i;
+ wdata[i].i1 = (int)i;
/* Allocate and initialize VL data to write in compound2 */
for (j = 0; j < SDIM_CMPD_ARRAY; j++) {
- wdata[i].cmpd2[j].i2 = (int) (j * 10);
- wdata[i].cmpd2[j].vl.p = HDmalloc((j + 1) * sizeof(cmpd3_t));
+ wdata[i].cmpd2[j].i2 = (int)(j * 10);
+ wdata[i].cmpd2[j].vl.p = HDmalloc((j + 1) * sizeof(cmpd3_t));
wdata[i].cmpd2[j].vl.len = j + 1;
for (k = 0; k < (j + 1); k++) {
/* Initialize data of compound3 */
- ((cmpd3_t *) wdata[i].cmpd2[j].vl.p)[k].i3 = (int) j * 10
- + diff;
- ((cmpd3_t *) wdata[i].cmpd2[j].vl.p)[k].f3 = (float) j * 10.5F
- + (float) diff;
+ ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].i3 = (int)j * 10 + diff;
+ ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)j * 10.5F + (float)diff;
} /* end for */
- } /* end for */
+ } /* end for */
}
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
if (is_file_new == 1)
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
else
@@ -4385,7 +4373,7 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
sid_dset = H5Screate_simple(1, sdims_dset, NULL);
/*-------------------------------------
- * Create a sub compound3 datatype */
+ * Create a sub compound3 datatype */
tid_cmpd3 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd3_t));
/* Insert integer field */
@@ -4397,7 +4385,7 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
assert(ret >= 0);
/*-------------------------------------
- * Create a sub compound2 datatype */
+ * Create a sub compound2 datatype */
tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t));
/* Insert integer field */
@@ -4405,12 +4393,12 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
assert(ret >= 0);
/* Create a VL datatype */
tid_cmpd2_vlen = H5Tvlen_create(tid_cmpd3);
- ret = H5Tinsert(tid_cmpd2, "vlen", HOFFSET(cmpd2_t, vl), tid_cmpd2_vlen);
+ ret = H5Tinsert(tid_cmpd2, "vlen", HOFFSET(cmpd2_t, vl), tid_cmpd2_vlen);
assert(ret >= 0);
/*-----------------------------------
- * Create a top compound1 datatype for dataset.
- */
+ * Create a top compound1 datatype for dataset.
+ */
tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t));
/* Create an array datatype */
@@ -4419,7 +4407,7 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
H5Tinsert(tid_cmpd1, "array_comp", HOFFSET(cmpd1_t, cmpd2), tid_arry1);
/* ----------------------
- * Create a dataset */
+ * Create a dataset */
did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write dataset to disk */
@@ -4427,8 +4415,8 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
assert(ret >= 0);
/*-----------------------------------
- * Create an attribute in root group
- */
+ * Create an attribute in root group
+ */
tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT);
assert(tid_attr > 0);
ret = H5Awrite(tid_attr, tid_cmpd1, wdata);
@@ -4439,7 +4427,7 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
assert(ret >= 0);
/*-------------------
- * Close IDs */
+ * Close IDs */
ret = H5Aclose(tid_attr);
assert(ret >= 0);
ret = H5Tclose(tid_arry1);
@@ -4460,70 +4448,71 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
assert(ret >= 0);
}
-static void test_comps_vlen_arry(const char * fname, const char *dset, const char *attr, int diff, int is_file_new)
+static void
+test_comps_vlen_arry(const char *fname, const char *dset, const char *attr, int diff, int is_file_new)
{
/* sub compound 3 */
typedef struct {
- int i3;
+ int i3;
float f3;
} cmpd3_t;
/* sub compound 2 */
typedef struct {
- int i2;
+ int i2;
cmpd3_t cmpd3[SDIM_CMPD_ARRAY];
} cmpd2_t;
/* top compound 1 */
typedef struct {
- int i1;
+ int i1;
hvl_t vl; /* VL information for compound2 */
} cmpd1_t;
cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */
- hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */
- hid_t did_dset = H5I_INVALID_HID; /* dataset ID */
- hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */
- hid_t tid_attr = H5I_INVALID_HID;
- hid_t tid_cmpd3 = H5I_INVALID_HID; /* compound3 type ID */
- hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */
- hid_t tid_cmpd2_arry = H5I_INVALID_HID;
- hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */
- hid_t tid_cmpd1_vlen = H5I_INVALID_HID;
- hsize_t sdims_dset[] = { SDIM_DSET };
- hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY };
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */
+ hid_t did_dset = H5I_INVALID_HID; /* dataset ID */
+ hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */
+ hid_t tid_attr = H5I_INVALID_HID;
+ hid_t tid_cmpd3 = H5I_INVALID_HID; /* compound3 type ID */
+ hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */
+ hid_t tid_cmpd2_arry = H5I_INVALID_HID;
+ hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */
+ hid_t tid_cmpd1_vlen = H5I_INVALID_HID;
+ hsize_t sdims_dset[] = {SDIM_DSET};
+ hsize_t sdims_cmpd_arry[] = {SDIM_CMPD_ARRAY};
unsigned i, j, k; /* counting variables */
- herr_t ret; /* Generic return value */
+ herr_t ret; /* Generic return value */
/* Allocate and initialize VL data to write */
for (i = 0; i < SDIM_DSET; i++) {
/* compound 1 data */
- wdata[i].i1 = (int) i;
- wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
+ wdata[i].i1 = (int)i;
+ wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
wdata[i].vl.len = i + 1;
for (j = 0; j < (i + 1); j++) {
/* compound2 data */
- ((cmpd2_t *) wdata[i].vl.p)[j].i2 = (int) i * 10 + diff;
+ ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)i * 10 + diff;
for (k = 0; k < SDIM_CMPD_ARRAY; k++) {
/* compound 3 data */
- ((cmpd2_t *) (wdata[i].vl.p))[j].cmpd3[k].i3 = (int) ((float) k * 10.5F) + diff;
- ((cmpd2_t *) (wdata[i].vl.p))[j].cmpd3[k].f3 = (float) k * 10.5F + (float) diff;
+ ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = (int)((float)k * 10.5F) + diff;
+ ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)k * 10.5F + (float)diff;
} /* end for */
- } /* end for */
- } /* end for */
+ } /* end for */
+ } /* end for */
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
if (is_file_new == 1)
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
else
fid = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT);
/* -----------------------------
- * Create sub compound3 type */
+ * Create sub compound3 type */
tid_cmpd3 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd3_t));
/* Insert fields */
@@ -4533,45 +4522,44 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha
assert(ret >= 0);
/* -----------------------------
- * Create sub compound2 type */
+ * Create sub compound2 type */
tid_cmpd2 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd2_t));
ret = H5Tinsert(tid_cmpd2, "int2", HOFFSET(cmpd2_t, i2), H5T_NATIVE_INT);
assert(ret >= 0);
tid_cmpd2_arry = H5Tarray_create2(tid_cmpd3, 1, sdims_cmpd_arry);
- ret = H5Tinsert(tid_cmpd2, "array_cmpd2", HOFFSET(cmpd2_t, cmpd3), tid_cmpd2_arry);
+ ret = H5Tinsert(tid_cmpd2, "array_cmpd2", HOFFSET(cmpd2_t, cmpd3), tid_cmpd2_arry);
assert(ret >= 0);
/* ---------------------------
- * Create top compound1 type
- */
+ * Create top compound1 type
+ */
/* Create a VL datatype */
tid_cmpd1 = H5Tcreate(H5T_COMPOUND, sizeof(cmpd1_t));
/* Insert fields */
ret = H5Tinsert(tid_cmpd1, "int1", HOFFSET(cmpd1_t, i1), H5T_NATIVE_INT);
assert(ret >= 0);
tid_cmpd1_vlen = H5Tvlen_create(tid_cmpd2);
- ret = H5Tinsert(tid_cmpd1, "vlen_cmpd1", HOFFSET(cmpd1_t, vl), tid_cmpd1_vlen);
+ ret = H5Tinsert(tid_cmpd1, "vlen_cmpd1", HOFFSET(cmpd1_t, vl), tid_cmpd1_vlen);
assert(ret >= 0);
/* -------------------------------
- * Create dataset with compound1
- */
+ * Create dataset with compound1
+ */
/* Create dataspace for dataset */
sid_dset = H5Screate_simple(1, sdims_dset, NULL);
/* Create a dataset */
- did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ did_dset = H5Dcreate2(fid, dset, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write dataset to disk */
ret = H5Dwrite(did_dset, tid_cmpd1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
assert(ret >= 0);
/*-----------------------------------
- * Create an attribute in root group
- */
+ * Create an attribute in root group
+ */
tid_attr = H5Acreate2(fid, attr, tid_cmpd1, sid_dset, H5P_DEFAULT, H5P_DEFAULT);
assert(tid_attr > 0);
ret = H5Awrite(tid_attr, tid_cmpd1, wdata);
@@ -4582,7 +4570,7 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha
assert(ret >= 0);
/* ----------------
- * Close IDs */
+ * Close IDs */
ret = H5Aclose(tid_attr);
assert(ret >= 0);
ret = H5Dclose(did_dset);
@@ -4613,83 +4601,83 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha
*
*-------------------------------------------------------------------------*/
#define DIM_ARRY 3
-static void test_data_nocomparables(const char * fname, int make_diffs)
+static void
+test_data_nocomparables(const char *fname, int make_diffs)
{
- hid_t fid = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hid_t did1 = H5I_INVALID_HID;
- hid_t did2 = H5I_INVALID_HID;
- hid_t sid1 = H5I_INVALID_HID;
- hid_t tid_dset1 = H5I_INVALID_HID;
- hid_t tid_attr1 = H5I_INVALID_HID;
- hsize_t dims1_1[1] = { DIM_ARRY };
- hsize_t dims1_2[1] = { DIM_ARRY + 1 };
- hsize_t dims2[2] = { DIM_ARRY, 1 };
- int data1[DIM_ARRY] = { 0, 0, 0 };
- int data2[DIM_ARRY] = { 1, 1, 1 };
- int data3[DIM_ARRY + 1] = { 1, 1, 1, 1 };
- int data1_dim2[DIM_ARRY][1] = { { 0 }, { 0 }, { 0 } };
- int rank_attr;
- char data1_str[DIM_ARRY][STR_SIZE] = { "ab", "cd", "ef" };
- herr_t status = SUCCEED;
- void *dset_data_ptr1 = NULL;
- void *dset_data_ptr2 = NULL;
- void *dset_data_ptr3 = NULL;
- void *attr_data_ptr1 = NULL;
- void *attr_data_ptr2 = NULL;
- void *attr_data_ptr3 = NULL;
- void *attr_data_ptr4 = NULL;
- void *attr2_dim_ptr = NULL;
- void *attr3_dim_ptr = NULL;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t did1 = H5I_INVALID_HID;
+ hid_t did2 = H5I_INVALID_HID;
+ hid_t sid1 = H5I_INVALID_HID;
+ hid_t tid_dset1 = H5I_INVALID_HID;
+ hid_t tid_attr1 = H5I_INVALID_HID;
+ hsize_t dims1_1[1] = {DIM_ARRY};
+ hsize_t dims1_2[1] = {DIM_ARRY + 1};
+ hsize_t dims2[2] = {DIM_ARRY, 1};
+ int data1[DIM_ARRY] = {0, 0, 0};
+ int data2[DIM_ARRY] = {1, 1, 1};
+ int data3[DIM_ARRY + 1] = {1, 1, 1, 1};
+ int data1_dim2[DIM_ARRY][1] = {{0}, {0}, {0}};
+ int rank_attr;
+ char data1_str[DIM_ARRY][STR_SIZE] = {"ab", "cd", "ef"};
+ herr_t status = SUCCEED;
+ void * dset_data_ptr1 = NULL;
+ void * dset_data_ptr2 = NULL;
+ void * dset_data_ptr3 = NULL;
+ void * attr_data_ptr1 = NULL;
+ void * attr_data_ptr2 = NULL;
+ void * attr_data_ptr3 = NULL;
+ void * attr_data_ptr4 = NULL;
+ void * attr2_dim_ptr = NULL;
+ void * attr3_dim_ptr = NULL;
/* init */
- tid_dset1 = H5Tcopy(H5T_NATIVE_INT);
- dset_data_ptr1 = (int*) &data1;
- dset_data_ptr2 = (int*) &data1;
- dset_data_ptr3 = (int*) &data1;
- tid_attr1 = H5Tcopy(H5T_NATIVE_INT);
- attr_data_ptr1 = (int*) &data1;
- attr_data_ptr3 = (int*) &data1;
- attr_data_ptr4 = (int*) &data1;
- attr2_dim_ptr = (hsize_t*) &dims1_1;
- attr3_dim_ptr = (hsize_t*) &dims1_1;
- rank_attr = 1;
+ tid_dset1 = H5Tcopy(H5T_NATIVE_INT);
+ dset_data_ptr1 = (int *)&data1;
+ dset_data_ptr2 = (int *)&data1;
+ dset_data_ptr3 = (int *)&data1;
+ tid_attr1 = H5Tcopy(H5T_NATIVE_INT);
+ attr_data_ptr1 = (int *)&data1;
+ attr_data_ptr3 = (int *)&data1;
+ attr_data_ptr4 = (int *)&data1;
+ attr2_dim_ptr = (hsize_t *)&dims1_1;
+ attr3_dim_ptr = (hsize_t *)&dims1_1;
+ rank_attr = 1;
if (make_diffs) {
/* ------------
- * group1 */
+ * group1 */
tid_dset1 = H5Tcopy(H5T_C_S1);
- H5Tset_size(tid_dset1, (size_t) STR_SIZE);
- dset_data_ptr1 = (char*) &data1_str;
- dset_data_ptr2 = (int*) &data2;
- attr_data_ptr1 = (int*) &data2;
+ H5Tset_size(tid_dset1, (size_t)STR_SIZE);
+ dset_data_ptr1 = (char *)&data1_str;
+ dset_data_ptr2 = (int *)&data2;
+ attr_data_ptr1 = (int *)&data2;
/* -----------
- * group2
- */
- dset_data_ptr3 = (int*) &data2;
+ * group2
+ */
+ dset_data_ptr3 = (int *)&data2;
/* dset1/attr1 */
tid_attr1 = H5Tcopy(H5T_C_S1);
- H5Tset_size(tid_attr1, (size_t) STR_SIZE);
- attr_data_ptr2 = (char*) &data1_str;
+ H5Tset_size(tid_attr1, (size_t)STR_SIZE);
+ attr_data_ptr2 = (char *)&data1_str;
/* dset1/attr2 */
- attr2_dim_ptr = (hsize_t*) &dims1_2;
+ attr2_dim_ptr = (hsize_t *)&dims1_2;
/* dset1/attr3 */
- attr_data_ptr3 = (int*) &data1_dim2;
- attr3_dim_ptr = (hsize_t*) &dims2;
- rank_attr = 2;
+ attr_data_ptr3 = (int *)&data1_dim2;
+ attr3_dim_ptr = (hsize_t *)&dims2;
+ rank_attr = 2;
/* dset1/attr4 */
- attr_data_ptr4 = (int*) &data2;
-
+ attr_data_ptr4 = (int *)&data2;
}
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid < 0) {
HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname);
@@ -4698,8 +4686,8 @@ static void test_data_nocomparables(const char * fname, int make_diffs)
}
/*-----------------------------------------------------------------------
- * Groups
- *------------------------------------------------------------------------*/
+ * Groups
+ *------------------------------------------------------------------------*/
gid1 = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid1 < 0) {
HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname);
@@ -4715,8 +4703,8 @@ static void test_data_nocomparables(const char * fname, int make_diffs)
}
/*-----------------------------------------------------------------------
- * Datasets in /g1
- *------------------------------------------------------------------------*/
+ * Datasets in /g1
+ *------------------------------------------------------------------------*/
if ((sid1 = H5Screate_simple(1, dims1_1, NULL)) < 0)
goto out;
@@ -4742,10 +4730,10 @@ static void test_data_nocomparables(const char * fname, int make_diffs)
}
/*-----------------------------------------------------------------------
- * Datasets in /g2
- *------------------------------------------------------------------------*/
+ * Datasets in /g2
+ *------------------------------------------------------------------------*/
/* ---------
- * dset1 */
+ * dset1 */
if ((did2 = H5Dcreate2(gid2, "dset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1");
status = FAIL;
@@ -4761,16 +4749,16 @@ static void test_data_nocomparables(const char * fname, int make_diffs)
write_attr(did2, 1, dims1_1, "attr1", tid_attr1, attr_data_ptr2);
/* attr2 - non-compatible : same rank, different dimention */
- write_attr(did2, 1, (hsize_t *) attr2_dim_ptr, "attr2", H5T_NATIVE_INT, data3);
+ write_attr(did2, 1, (hsize_t *)attr2_dim_ptr, "attr2", H5T_NATIVE_INT, data3);
/* attr3 - non-compatible : different rank */
- write_attr(did2, rank_attr, (hsize_t *) attr3_dim_ptr, "attr3", H5T_NATIVE_INT, attr_data_ptr3);
+ write_attr(did2, rank_attr, (hsize_t *)attr3_dim_ptr, "attr3", H5T_NATIVE_INT, attr_data_ptr3);
/* attr4 - compatible : different data values */
write_attr(did2, 1, dims1_1, "attr4", H5T_NATIVE_INT, attr_data_ptr4);
/*----------
- * dset2 */
+ * dset2 */
status = write_dset(gid2, 1, dims1_1, "dset2", H5T_NATIVE_INT, dset_data_ptr3);
if (status == FAIL) {
HDfprintf(stderr, "Error: %s> write_dset failed\n", fname);
@@ -4780,8 +4768,8 @@ static void test_data_nocomparables(const char * fname, int make_diffs)
out:
/*-----------------------------------------------------------------------
- * Close IDs
- *-----------------------------------------------------------------------*/
+ * Close IDs
+ *-----------------------------------------------------------------------*/
if (fid)
H5Fclose(fid);
if (gid1)
@@ -4811,95 +4799,96 @@ out:
static void
test_objs_nocomparables(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t topgid1 = H5I_INVALID_HID;
- hid_t topgid2 = H5I_INVALID_HID;
- hid_t gid1 = H5I_INVALID_HID;
- hid_t tid1 = H5I_INVALID_HID;
- hid_t gid2 = H5I_INVALID_HID;
- hid_t tid2 = H5I_INVALID_HID;
- hsize_t dims[1] = { DIM_ARRY };
- int data1[DIM_ARRY] = { 1, 1, 1 };
- int data2[DIM_ARRY] = { 2, 2, 2 };
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t topgid1 = H5I_INVALID_HID;
+ hid_t topgid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t tid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t tid2 = H5I_INVALID_HID;
+ hsize_t dims[1] = {DIM_ARRY};
+ int data1[DIM_ARRY] = {1, 1, 1};
+ int data2[DIM_ARRY] = {2, 2, 2};
/*-----------------------------------------------------------------------
- * Open file(s) to add objects
- *------------------------------------------------------------------------*/
+ * Open file(s) to add objects
+ *------------------------------------------------------------------------*/
/* file1 */
- if((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
PROGRAM_ERROR
/* file2 */
- if((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
PROGRAM_ERROR
/*-----------------------------------------------------------------------
- * in file1 : add member objects
- *------------------------------------------------------------------------*/
+ * in file1 : add member objects
+ *------------------------------------------------------------------------*/
/* parent group */
- if((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
PROGRAM_ERROR
/* dataset */
- if(write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0)
+ if (write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0)
PROGRAM_ERROR
/* group */
- if((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
PROGRAM_ERROR
/* committed type */
- if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0)
PROGRAM_ERROR
- if(H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
PROGRAM_ERROR
/*-----------------------------------------------------------------------
- * in file2 : add member objects
- *------------------------------------------------------------------------*/
+ * in file2 : add member objects
+ *------------------------------------------------------------------------*/
/* parent group */
- if((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
PROGRAM_ERROR
/* group */
- if((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
PROGRAM_ERROR
/* committed type */
- if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0)
PROGRAM_ERROR
- if(H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
PROGRAM_ERROR
/* dataset */
- if(write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0)
+ if (write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0)
PROGRAM_ERROR
/*-----------------------------------------------------------------------
- * Close IDs
- *-----------------------------------------------------------------------*/
- if(H5Fclose(fid1) < 0)
+ * Close IDs
+ *-----------------------------------------------------------------------*/
+ if (H5Fclose(fid1) < 0)
PROGRAM_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
PROGRAM_ERROR
- if(H5Gclose(topgid1) < 0)
+ if (H5Gclose(topgid1) < 0)
PROGRAM_ERROR
- if(H5Gclose(topgid2) < 0)
+ if (H5Gclose(topgid2) < 0)
PROGRAM_ERROR
- if(H5Gclose(gid1) < 0)
+ if (H5Gclose(gid1) < 0)
PROGRAM_ERROR
- if(H5Gclose(gid2) < 0)
+ if (H5Gclose(gid2) < 0)
PROGRAM_ERROR
- if(H5Tclose(tid1) < 0)
+ if (H5Tclose(tid1) < 0)
PROGRAM_ERROR
- if(H5Tclose(tid2) < 0)
+ if (H5Tclose(tid2) < 0)
PROGRAM_ERROR
return;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid1);
H5Fclose(fid2);
H5Gclose(topgid1);
@@ -4908,18 +4897,20 @@ error:
H5Gclose(gid2);
H5Tclose(tid1);
H5Tclose(tid2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return;
}
-static hid_t mkstr(int size, H5T_str_t pad)
+static hid_t
+mkstr(int size, H5T_str_t pad)
{
hid_t type;
if ((type = H5Tcopy(H5T_C_S1)) < 0)
return -1;
- if (H5Tset_size(type, (size_t) size) < 0)
+ if (H5Tset_size(type, (size_t)size) < 0)
return -1;
if (H5Tset_strpad(type, pad) < 0)
return -1;
@@ -4935,51 +4926,44 @@ static hid_t mkstr(int size, H5T_str_t pad)
* types.
* h5diff should show differences output from these common objects.
*-------------------------------------------------------------------------*/
-static void test_objs_strings(const char *fname1, const char *fname2)
+static void
+test_objs_strings(const char *fname1, const char *fname2)
{
- hid_t fid1 = H5I_INVALID_HID;
- hid_t fid2 = H5I_INVALID_HID;
- hid_t dataset = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t f_type = H5I_INVALID_HID;
- hid_t m_type = H5I_INVALID_HID;
- hsize_t dims1[] = { 3, 4 };
- char string1A[12][3] = { "s1", "s2", "s3", "s4", "s5", "s6", "s", "s", "s9",
- "s0", "s1", "s2" };
- char string1B[12][3] = { "s1", "s2", "s3", "s4", "s", "s", "s7", "s8", "s9",
- "s0", "s1", "s2" };
-
- hsize_t dims2[] = { 20 };
- char string2A[20][10] = { "ab cd ef1", "ab cd ef2", "ab cd ef3",
- "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8",
- "ab cd 9", "ab cd 0", "ab cd 1", "ab cd 2", "ab cd ef3",
- "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8",
- "ab cd ef9", "ab cd ef0" };
- char string2B[20][10] = { "ab cd ef1", "ab cd ef2", "ab cd ef3",
- "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8",
- "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2", "ab cd 3",
- "ab cd 4", "ab cd 5", "ab cd 6", "ab cd ef7", "ab cd ef8",
- "ab cd ef9", "ab cd ef0" };
-
- hsize_t dims3[] = { 27 };
- char string3A[27][6] = { "abcd0", "abcd1", "abcd2", "abcd3", "abcd4",
- "abcd5", "abcd6", "abcd7", "abcd8", "abcd9", "abcd0", "abcd1",
- "abd2", "abc3", "bcd4", "acd5", "abcd6", "abcd7", "abcd8", "abcd9",
- "abcd0", "abcd1", "abcd2", "abcd3", "abc4", "abc5", "abc6" };
- char string3B[27][6] = { "abcd0", "abcd1", "abcd2", "abcd3", "abcd4",
- "abcd5", "abcd6", "abcd7", "abcd8", "abcd9", "abcd0", "abcd1",
- "abcd2", "abcd3", "abcd4", "abcd5", "abd6", "abc7", "bcd8", "acd9",
- "abcd0", "abcd1", "abcd2", "abcd3", "abd4", "abd5", "abd6" };
-
- hsize_t dims4[] = { 3 };
- char string4A[3][21] = { "s1234567890123456789", "s1234567890123456789",
- "s12345678901234567" };
- char string4B[3][21] = { "s1234567890123456789", "s12345678901234567",
- "s1234567890123456789" };
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t f_type = H5I_INVALID_HID;
+ hid_t m_type = H5I_INVALID_HID;
+ hsize_t dims1[] = {3, 4};
+ char string1A[12][3] = {"s1", "s2", "s3", "s4", "s5", "s6", "s", "s", "s9", "s0", "s1", "s2"};
+ char string1B[12][3] = {"s1", "s2", "s3", "s4", "s", "s", "s7", "s8", "s9", "s0", "s1", "s2"};
+
+ hsize_t dims2[] = {20};
+ char string2A[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", "ab cd ef5",
+ "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd 9", "ab cd 0",
+ "ab cd 1", "ab cd 2", "ab cd ef3", "ab cd ef4", "ab cd ef5",
+ "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"};
+ char string2B[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", "ab cd ef5",
+ "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0",
+ "ab cd ef1", "ab cd ef2", "ab cd 3", "ab cd 4", "ab cd 5",
+ "ab cd 6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"};
+
+ hsize_t dims3[] = {27};
+ char string3A[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6", "abcd7", "abcd8",
+ "abcd9", "abcd0", "abcd1", "abd2", "abc3", "bcd4", "acd5", "abcd6", "abcd7",
+ "abcd8", "abcd9", "abcd0", "abcd1", "abcd2", "abcd3", "abc4", "abc5", "abc6"};
+ char string3B[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6", "abcd7", "abcd8",
+ "abcd9", "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abd6", "abc7",
+ "bcd8", "acd9", "abcd0", "abcd1", "abcd2", "abcd3", "abd4", "abd5", "abd6"};
+
+ hsize_t dims4[] = {3};
+ char string4A[3][21] = {"s1234567890123456789", "s1234567890123456789", "s12345678901234567"};
+ char string4B[3][21] = {"s1234567890123456789", "s12345678901234567", "s1234567890123456789"};
/*-----------------------------------------------------------------------
- * Create file(s)
- *------------------------------------------------------------------------*/
+ * Create file(s)
+ *------------------------------------------------------------------------*/
/* file1 */
fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0) {
@@ -4995,9 +4979,9 @@ static void test_objs_strings(const char *fname1, const char *fname2)
}
/* string 1 : nullterm string */
- space = H5Screate_simple(2, dims1, NULL);
- f_type = mkstr(5, H5T_STR_NULLTERM);
- m_type = mkstr(3, H5T_STR_NULLTERM);
+ space = H5Screate_simple(2, dims1, NULL);
+ f_type = mkstr(5, H5T_STR_NULLTERM);
+ m_type = mkstr(3, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid1, "/string1", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string1A);
H5Dclose(dataset);
@@ -5009,9 +4993,9 @@ static void test_objs_strings(const char *fname1, const char *fname2)
H5Dclose(dataset);
/* string 2 : space pad string */
- space = H5Screate_simple(1, dims2, NULL);
- f_type = mkstr(11, H5T_STR_SPACEPAD);
- m_type = mkstr(10, H5T_STR_NULLTERM);
+ space = H5Screate_simple(1, dims2, NULL);
+ f_type = mkstr(11, H5T_STR_SPACEPAD);
+ m_type = mkstr(10, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid1, "/string2", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string2A);
H5Dclose(dataset);
@@ -5023,9 +5007,9 @@ static void test_objs_strings(const char *fname1, const char *fname2)
H5Dclose(dataset);
/* string 3 : null pad string */
- space = H5Screate_simple(1, dims3, NULL);
- f_type = mkstr(8, H5T_STR_NULLPAD);
- m_type = mkstr(6, H5T_STR_NULLTERM);
+ space = H5Screate_simple(1, dims3, NULL);
+ f_type = mkstr(8, H5T_STR_NULLPAD);
+ m_type = mkstr(6, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid1, "/string3", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string3A);
H5Dclose(dataset);
@@ -5037,9 +5021,9 @@ static void test_objs_strings(const char *fname1, const char *fname2)
H5Dclose(dataset);
/* string 4 : space pad long string */
- space = H5Screate_simple(1, dims4, NULL);
- f_type = mkstr(168, H5T_STR_SPACEPAD);
- m_type = mkstr(21, H5T_STR_NULLTERM);
+ space = H5Screate_simple(1, dims4, NULL);
+ f_type = mkstr(168, H5T_STR_SPACEPAD);
+ m_type = mkstr(21, H5T_STR_NULLTERM);
dataset = H5Dcreate2(fid1, "/string4", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4A);
H5Dclose(dataset);
@@ -5065,10 +5049,10 @@ static void test_objs_strings(const char *fname1, const char *fname2)
string4B[2][11] = 'a';
string4B[2][12] = 'B';
string4B[2][13] = 'c';
- space = H5Screate_simple(1, dims4, NULL);
- f_type = mkstr(168, H5T_STR_NULLTERM);
- m_type = mkstr(21, H5T_STR_NULLTERM);
- dataset = H5Dcreate2(fid1, "/string5", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ space = H5Screate_simple(1, dims4, NULL);
+ f_type = mkstr(168, H5T_STR_NULLTERM);
+ m_type = mkstr(21, H5T_STR_NULLTERM);
+ dataset = H5Dcreate2(fid1, "/string5", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Dwrite(dataset, m_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, string4A);
H5Dclose(dataset);
dataset = H5Dcreate2(fid2, "/string5", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
@@ -5080,8 +5064,8 @@ static void test_objs_strings(const char *fname1, const char *fname2)
out:
/*-----------------------------------------------------------------------
- * Close IDs
- *-----------------------------------------------------------------------*/
+ * Close IDs
+ *-----------------------------------------------------------------------*/
if (fid1)
H5Fclose(fid1);
if (fid2)
@@ -5096,78 +5080,77 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
-void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */)
+static void
+write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid,
+ int make_diffs /* flag to modify data buffers */)
{
/* Compound datatype */
typedef struct s_t {
- char a;
+ char a;
double b;
} s_t;
- typedef enum {
- RED, GREEN
- } e_t;
+ typedef enum { RED, GREEN } e_t;
- hid_t aid = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
+ hid_t aid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
herr_t status;
- int val, i, j, k, l, n;
- float f;
+ int val, i, j, k, l, n;
+ float f;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1] = { 2 };
- char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */
- char *buf1a[2]; /* VL string */
- char buf2[2] = { 1, 2 }; /* bitfield, opaque */
- s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- e_t buf45[2] = { RED, RED }; /* enum */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1] = { 3 }; /* array dimension */
- int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */
- int buf7[2] = { 1, 2 }; /* integer */
- float buf8[2] = { 1.0F, 2.0F }; /* float */
+ hsize_t dims[1] = {2};
+ char buf1[2][STR_SIZE] = {"ab", "de"}; /* string */
+ char * buf1a[2]; /* VL string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2.0F}, {3, 4.0F}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2] = {RED, RED}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1.0F, 2.0F}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2] = { 3, 2 };
- char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */
- char *buf12a[3][2]; /* VL string */
- char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */
- s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- e_t buf452[3][2]; /* enum */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */
- int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */
- float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */
+ hsize_t dims2[2] = {3, 2};
+ char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */
+ char * buf12a[3][2]; /* VL string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2.0F}, {3, 4.0F}, {5, 6.0F}, {7, 8.0F}, {9, 10.0F}, {11, 12.0F}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ e_t buf452[3][2]; /* enum */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1.0F, 2.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3] = { 4, 3, 2 };
- char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } },
- { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } },
- { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } },
- { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */
- char *buf13a[4][3][2]; /* VL string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[4][3][2]; /* reference */
- e_t buf453[4][3][2]; /* enum */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
-
- /*-------------------------------------------------------------------------
- * 1D attributes
- *-------------------------------------------------------------------------
- */
+ hsize_t dims3[3] = {4, 3, 2};
+ char buf13[4][3][2][STR_SIZE] = {{{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}},
+ {{"mn", "pq"}, {"rs", "tu"}, {"vw", "xz"}},
+ {{"AB", "CD"}, {"EF", "GH"}, {"IJ", "KL"}},
+ {{"MN", "PQ"}, {"RS", "TU"}, {"VW", "XZ"}}}; /* string */
+ char * buf13a[4][3][2]; /* VL string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ e_t buf453[4][3][2]; /* enum */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+ /*-------------------------------------------------------------------------
+ * 1D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -5189,20 +5172,20 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
for (i = 0; i < 2; i++)
buf1a[i] = buf1[i];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_attr(loc_id, 1, dims, "string", tid, buf1a);
status = H5Tclose(tid);
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, (size_t)STR_SIZE);
write_attr(loc_id, 1, dims, "VLstring", tid, buf1);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -5224,9 +5207,9 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
/*
buf2[2]= {1,2};
@@ -5240,15 +5223,15 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
[ 1 ] 2 0 2
*/
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_attr(loc_id, 1, dims, "opaque", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++) {
@@ -5276,13 +5259,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
- status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1);
- status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4);
}
@@ -5316,18 +5299,18 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc(1 * sizeof(int));
- ((int *) buf5[0].p)[0] = 1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc(2 * sizeof(int));
- ((int *) buf5[1].p)[0] = 2;
- ((int *) buf5[1].p)[1] = 3;
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
+ ((int *)buf5[1].p)[0] = 2;
+ ((int *)buf5[1].p)[1] = 3;
if (make_diffs) {
- ((int *) buf5[0].p)[0] = 0;
- ((int *) buf5[1].p)[0] = 0;
- ((int *) buf5[1].p)[1] = 0;
+ ((int *)buf5[0].p)[0] = 0;
+ ((int *)buf5[1].p)[0] = 0;
+ ((int *)buf5[1].p)[1] = 0;
}
/*
$h5diff file7.h5 file6.h5 g1 g1 -v
@@ -5339,9 +5322,9 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
[ 1 ] 3 0 3
*/
- sid = H5Screate_simple(1, dims, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf5);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
@@ -5443,13 +5426,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
for (j = 0; j < 2; j++)
buf12a[i][j] = buf12[i][j];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_attr(loc_id, 2, dims2, "string2D", tid, buf12a);
status = H5Tclose(tid);
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_attr(loc_id, 2, dims2, "VLstring2D", tid, buf12);
status = H5Tclose(tid);
@@ -5496,7 +5479,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
[ 2 0 ] 5 0 5
[ 2 1 ] 6 0 6
*/
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_attr(loc_id, 2, dims2, "opaque2D", tid, buf22);
status = H5Tclose(tid);
@@ -5536,8 +5519,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
if (dset_name) {
for (i = 0; i < 3; i++)
for (j = 0; j < 2; j++)
- status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT,
- (hid_t) -1);
+ status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42);
}
@@ -5579,13 +5561,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
n = 0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 2; j++) {
- buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++)
if (make_diffs)
- ((int *) buf52[i][j].p)[l] = 0;
+ ((int *)buf52[i][j].p)[l] = 0;
else
- ((int *) buf52[i][j].p)[l] = n++;
+ ((int *)buf52[i][j].p)[l] = n++;
}
}
@@ -5605,9 +5587,9 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
[ 2 1 ] 11 0 11
*/
- sid = H5Screate_simple(2, dims2, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf52);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
@@ -5766,13 +5748,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
for (k = 0; k < 2; k++)
buf13a[i][j][k] = buf13[i][j][k];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_attr(loc_id, 3, dims3, "string3D", tid, buf13a);
status = H5Tclose(tid);
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_attr(loc_id, 3, dims3, "VLstring3D", tid, buf13);
status = H5Tclose(tid);
@@ -5788,7 +5770,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
if (make_diffs)
buf23[i][j][k] = 0;
else
- buf23[i][j][k] = (char) n++;
+ buf23[i][j][k] = (char)n++;
/*
position bitfield3D of </g1> bitfield3D of </g1> difference
@@ -5827,7 +5809,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
* H5T_OPAQUE
*-------------------------------------------------------------------------
*/
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_attr(loc_id, 3, dims3, "opaque3D", tid, buf23);
status = H5Tclose(tid);
@@ -5844,8 +5826,9 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
if (make_diffs) {
buf33[i][j][k].a = 0;
buf33[i][j][k].b = 0.0F;
- } else {
- buf33[i][j][k].a = (char) n++;
+ }
+ else {
+ buf33[i][j][k].a = (char)n++;
buf33[i][j][k].b = n++;
}
/*position compound3D of </g1> compound3D of </g1> difference
@@ -5915,8 +5898,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++)
- status = H5Rcreate(&buf43[i][j][k], fid, dset_name,
- H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43);
}
@@ -5978,13 +5960,13 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++) {
- buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++)
if (make_diffs)
- ((int *) buf53[i][j][k].p)[l] = 0;
+ ((int *)buf53[i][j][k].p)[l] = 0;
else
- ((int *) buf53[i][j][k].p)[l] = n++;
+ ((int *)buf53[i][j][k].p)[l] = n++;
}
/*
position vlen3D of </g1> vlen3D of </g1> difference
@@ -6001,9 +5983,9 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
[ 1 1 0 ] 10 0 10
etc
*/
- sid = H5Screate_simple(3, dims3, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf53);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
@@ -6018,7 +6000,7 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
*/
n = 1;
for (i = 0; i < 24; i++) {
- for (j = 0; j < (int) dimarray[0]; j++) {
+ for (j = 0; j < (int)dimarray[0]; j++) {
if (make_diffs)
buf63[i][j] = 0;
else
@@ -6087,78 +6069,77 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
*
*-------------------------------------------------------------------------
*/
-static
-void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */)
+static void
+write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid,
+ int make_diffs /* flag to modify data buffers */)
{
/* Compound datatype */
typedef struct s_t {
- char a;
+ char a;
double b;
} s_t;
- typedef enum {
- RED, GREEN
- } e_t;
+ typedef enum { RED, GREEN } e_t;
- hid_t aid = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
+ hid_t aid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
herr_t status;
- int val, i, j, k, l, n;
- float f;
+ int val, i, j, k, l, n;
+ float f;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1] = { 2 };
- char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */
- char *buf1a[2]; /* VL string */
- char buf2[2] = { 1, 2 }; /* bitfield, opaque */
- s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- e_t buf45[2] = { RED, RED }; /* enum */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1] = { 3 }; /* array dimension */
- int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */
- int buf7[2] = { 1, 2 }; /* integer */
- float buf8[2] = { 1.0F, 2.0F }; /* float */
+ hsize_t dims[1] = {2};
+ char buf1[2][STR_SIZE] = {"ab", "de"}; /* string */
+ char * buf1a[2]; /* VL string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2.0F}, {3, 4.0F}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2] = {RED, RED}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1.0F, 2.0F}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2] = { 3, 2 };
- char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */
- char *buf12a[3][2]; /* VL string */
- char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */
- s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- e_t buf452[3][2]; /* enum */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */
- int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */
- float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */
+ hsize_t dims2[2] = {3, 2};
+ char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */
+ char * buf12a[3][2]; /* VL string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2.0F}, {3, 4.0F}, {5, 6.0F}, {7, 8.0F}, {9, 10.0F}, {11, 12.0F}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ e_t buf452[3][2]; /* enum */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1.0F, 2.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3] = { 4, 3, 2 };
- char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } },
- { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } },
- { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } },
- { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */
- char *buf13a[4][3][2]; /* VL string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[4][3][2]; /* reference */
- e_t buf453[4][3][2]; /* enum */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
-
- /*-------------------------------------------------------------------------
- * 1D attributes
- *-------------------------------------------------------------------------
- */
+ hsize_t dims3[3] = {4, 3, 2};
+ char buf13[4][3][2][STR_SIZE] = {{{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}},
+ {{"mn", "pq"}, {"rs", "tu"}, {"vw", "xz"}},
+ {{"AB", "CD"}, {"EF", "GH"}, {"IJ", "KL"}},
+ {{"MN", "PQ"}, {"RS", "TU"}, {"VW", "XZ"}}}; /* string */
+ char * buf13a[4][3][2]; /* VL string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ e_t buf453[4][3][2]; /* enum */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
+
+ /*-------------------------------------------------------------------------
+ * 1D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -6176,22 +6157,22 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 1 ] d z
[ 1 ] e z
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_attr(loc_id, 1, dims, "string", tid, buf1);
status = H5Tclose(tid);
for (i = 0; i < 2; i++)
buf1a[i] = buf1[i];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_attr(loc_id, 1, dims, "VLstring", tid, buf1a);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -6213,9 +6194,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
/*
buf2[2]= {1,2};
@@ -6229,15 +6210,15 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 1 ] 2 0 2
*/
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_attr(loc_id, 1, dims, "opaque", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++) {
@@ -6264,20 +6245,20 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
- status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1);
- status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_attr(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4);
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
buf45[i] = GREEN;
@@ -6298,24 +6279,24 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc(1 * sizeof(int));
- ((int *) buf5[0].p)[0] = 1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc(2 * sizeof(int));
- ((int *) buf5[1].p)[0] = 2;
- ((int *) buf5[1].p)[1] = 3;
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
+ ((int *)buf5[1].p)[0] = 2;
+ ((int *)buf5[1].p)[1] = 3;
if (make_diffs) {
- ((int *) buf5[0].p)[0] = 0;
- ((int *) buf5[1].p)[0] = 0;
- ((int *) buf5[1].p)[1] = 0;
+ ((int *)buf5[0].p)[0] = 0;
+ ((int *)buf5[1].p)[0] = 0;
+ ((int *)buf5[1].p)[1] = 0;
}
/*
$h5diff file7.h5 file6.h5 g1 g1 -v
@@ -6327,9 +6308,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 1 ] 3 0 3
*/
- sid = H5Screate_simple(1, dims, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf5);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
@@ -6339,9 +6320,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
for (i = 0; i < 2; i++)
@@ -6367,9 +6348,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
for (i = 0; i < 2; i++) {
@@ -6395,14 +6376,14 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
write_attr(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8);
/*-------------------------------------------------------------------------
- * 2D attributes
- *-------------------------------------------------------------------------
- */
+ * 2D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
for (i = 0; i < 3; i++)
for (j = 0; j < 2; j++)
@@ -6430,8 +6411,8 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 2 1 ] l z
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_attr(loc_id, 2, dims2, "string2D", tid, buf12);
status = H5Tclose(tid);
@@ -6439,15 +6420,15 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
for (j = 0; j < 2; j++)
buf12a[i][j] = buf12[i][j];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_attr(loc_id, 2, dims2, "VLstring2D", tid, buf12a);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
memset(buf22, 0, sizeof buf22);
@@ -6470,9 +6451,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
/*
buf22[3][2]= {{1,2},{3,4},{5,6}};
@@ -6487,15 +6468,15 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 2 0 ] 5 0 5
[ 2 1 ] 6 0 6
*/
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_attr(loc_id, 2, dims2, "opaque2D", tid, buf22);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
memset(buf32, 0, sizeof buf32);
/*
@@ -6519,21 +6500,21 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
for (i = 0; i < 3; i++)
for (j = 0; j < 2; j++)
- status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_attr(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42);
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
for (i = 0; i < 3; i++)
for (j = 0; j < 2; j++) {
if (make_diffs)
@@ -6561,21 +6542,21 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
n = 0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 2; j++) {
- buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++)
if (make_diffs)
- ((int *) buf52[i][j].p)[l] = 0;
+ ((int *)buf52[i][j].p)[l] = 0;
else
- ((int *) buf52[i][j].p)[l] = n++;
+ ((int *)buf52[i][j].p)[l] = n++;
}
}
@@ -6595,9 +6576,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 2 1 ] 11 0 11
*/
- sid = H5Screate_simple(2, dims2, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf52);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
@@ -6607,9 +6588,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
memset(buf62, 0, sizeof buf62);
@@ -6644,9 +6625,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
memset(buf72, 0, sizeof buf72);
@@ -6678,14 +6659,14 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
write_attr(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82);
/*-------------------------------------------------------------------------
- * 3D attributes
- *-------------------------------------------------------------------------
- */
+ * 3D attributes
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
for (i = 0; i < 4; i++)
@@ -6752,8 +6733,8 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 3 2 1 ] Z z
*/
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_attr(loc_id, 3, dims3, "string3D", tid, buf13);
status = H5Tclose(tid);
@@ -6761,15 +6742,15 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++)
buf13a[i][j][k] = buf13[i][j][k];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_attr(loc_id, 3, dims3, "VLstring3D", tid, buf13a);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
n = 1;
for (i = 0; i < 4; i++)
@@ -6778,7 +6759,7 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
if (make_diffs)
buf23[i][j][k] = 0;
else
- buf23[i][j][k] = (char) n++;
+ buf23[i][j][k] = (char)n++;
}
/*
position bitfield3D of </g1> bitfield3D of </g1> difference
@@ -6814,18 +6795,18 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_attr(loc_id, 3, dims3, "opaque3D", tid, buf23);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
n = 1;
for (i = 0; i < 4; i++)
@@ -6836,7 +6817,7 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
buf33[i][j][k].b = 0.0F;
}
else {
- buf33[i][j][k].a = (char) n++;
+ buf33[i][j][k].a = (char)n++;
buf33[i][j][k].b = n++;
}
}
@@ -6899,23 +6880,22 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++)
- status = H5Rcreate(&buf43[i][j][k], fid, dset_name,
- H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_attr(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43);
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
@@ -6961,22 +6941,22 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
n = 0;
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++) {
- buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++)
if (make_diffs)
- ((int *) buf53[i][j][k].p)[l] = 0;
+ ((int *)buf53[i][j][k].p)[l] = 0;
else
- ((int *) buf53[i][j][k].p)[l] = n++;
+ ((int *)buf53[i][j][k].p)[l] = n++;
}
/*
position vlen3D of </g1> vlen3D of </g1> difference
@@ -6993,9 +6973,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
[ 1 1 0 ] 10 0 10
etc
*/
- sid = H5Screate_simple(3, dims3, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ aid = H5Acreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf53);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
@@ -7005,12 +6985,12 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
n = 1;
for (i = 0; i < 24; i++)
- for (j = 0; j < (int) dimarray[0]; j++) {
+ for (j = 0; j < (int)dimarray[0]; j++) {
if (make_diffs)
buf63[i][j] = 0;
else
@@ -7034,9 +7014,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
n = 1;
f = 1;
for (i = 0; i < 4; i++)
@@ -7078,77 +7058,76 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
*
*-------------------------------------------------------------------------
*/
-static
-void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs /* flag to modify data buffers */)
+static void
+write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid,
+ int make_diffs /* flag to modify data buffers */)
{
/* Compound datatype */
typedef struct s_t {
- char a;
+ char a;
double b;
} s_t;
- typedef enum {
- RED, GREEN
- } e_t;
+ typedef enum { RED, GREEN } e_t;
- hid_t did = H5I_INVALID_HID;
- hid_t sid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
- hid_t dcpl = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
herr_t status;
- int val, i, j, k, l, n;
- float f;
- int fillvalue = 2;
- int scalar_data = 2;
+ int val, i, j, k, l, n;
+ float f;
+ int fillvalue = 2;
+ int scalar_data = 2;
/* create 1D attributes with dimension [2], 2 elements */
- hsize_t dims[1] = { 2 };
- char buf1[2][STR_SIZE] = { "ab", "de" }; /* string */
- char *buf1a[2]; /* VL string */
- char buf2[2] = { 1, 2 }; /* bitfield, opaque */
- s_t buf3[2] = { { 1, 2.0F }, { 3, 4.0F } }; /* compound */
- hobj_ref_t buf4[2]; /* reference */
- e_t buf45[2] = { RED, GREEN }; /* enum */
- hvl_t buf5[2]; /* vlen */
- hsize_t dimarray[1] = { 3 }; /* array dimension */
- int buf6[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } }; /* array */
- int buf7[2] = { 1, 2 }; /* integer */
- float buf8[2] = { 1.0F, 2.0F }; /* float */
+ hsize_t dims[1] = {2};
+ char buf1[2][STR_SIZE] = {"ab", "de"}; /* string */
+ char * buf1a[2]; /* VL string */
+ char buf2[2] = {1, 2}; /* bitfield, opaque */
+ s_t buf3[2] = {{1, 2.0F}, {3, 4.0F}}; /* compound */
+ hobj_ref_t buf4[2]; /* reference */
+ e_t buf45[2] = {RED, GREEN}; /* enum */
+ hvl_t buf5[2]; /* vlen */
+ hsize_t dimarray[1] = {3}; /* array dimension */
+ int buf6[2][3] = {{1, 2, 3}, {4, 5, 6}}; /* array */
+ int buf7[2] = {1, 2}; /* integer */
+ float buf8[2] = {1.0F, 2.0F}; /* float */
/* create 2D attributes with dimension [3][2], 6 elements */
- hsize_t dims2[2] = { 3, 2 };
- char buf12[3][2][STR_SIZE] = { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } }; /* string */
- char *buf12a[3][2]; /* VL string */
- char buf22[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* bitfield, opaque */
- s_t buf32[6] = { { 1, 2.0F }, { 3, 4.0F }, { 5, 6.0F }, { 7, 8.0F }, { 9, 10.0F }, { 11, 12.0F } }; /* compound */
- hobj_ref_t buf42[3][2]; /* reference */
- hvl_t buf52[3][2]; /* vlen */
- int buf62[6][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 10, 11, 12 }, { 13, 14, 15 }, { 16, 17, 18 } }; /* array */
- int buf72[3][2] = { { 1, 2 }, { 3, 4 }, { 5, 6 } }; /* integer */
- float buf82[3][2] = { { 1.0F, 2.0F }, { 3.0F, 4.0F }, { 5.0F, 6.0F } }; /* float */
+ hsize_t dims2[2] = {3, 2};
+ char buf12[3][2][STR_SIZE] = {{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}}; /* string */
+ char * buf12a[3][2]; /* VL string */
+ char buf22[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* bitfield, opaque */
+ s_t buf32[6] = {{1, 2.0F}, {3, 4.0F}, {5, 6.0F}, {7, 8.0F}, {9, 10.0F}, {11, 12.0F}}; /* compound */
+ hobj_ref_t buf42[3][2]; /* reference */
+ hvl_t buf52[3][2]; /* vlen */
+ int buf62[6][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18}}; /* array */
+ int buf72[3][2] = {{1, 2}, {3, 4}, {5, 6}}; /* integer */
+ float buf82[3][2] = {{1.0F, 2.0F}, {3.0F, 4.0F}, {5.0F, 6.0F}}; /* float */
/* create 3D attributes with dimension [4][3][2], 24 elements */
- hsize_t dims3[3] = { 4, 3, 2 };
- char buf13[4][3][2][STR_SIZE] = { { { "ab", "cd" }, { "ef", "gh" }, { "ij", "kl" } },
- { { "mn", "pq" }, { "rs", "tu" }, { "vw", "xz" } },
- { { "AB", "CD" }, { "EF", "GH" }, { "IJ", "KL" } },
- { { "MN", "PQ" }, { "RS", "TU" }, { "VW", "XZ" } } }; /* string */
- char *buf13a[4][3][2]; /* VL string */
- char buf23[4][3][2]; /* bitfield, opaque */
- s_t buf33[4][3][2]; /* compound */
- hobj_ref_t buf43[4][3][2]; /* reference */
- hvl_t buf53[4][3][2]; /* vlen */
- int buf63[24][3]; /* array */
- int buf73[4][3][2]; /* integer */
- float buf83[4][3][2]; /* float */
+ hsize_t dims3[3] = {4, 3, 2};
+ char buf13[4][3][2][STR_SIZE] = {{{"ab", "cd"}, {"ef", "gh"}, {"ij", "kl"}},
+ {{"mn", "pq"}, {"rs", "tu"}, {"vw", "xz"}},
+ {{"AB", "CD"}, {"EF", "GH"}, {"IJ", "KL"}},
+ {{"MN", "PQ"}, {"RS", "TU"}, {"VW", "XZ"}}}; /* string */
+ char * buf13a[4][3][2]; /* VL string */
+ char buf23[4][3][2]; /* bitfield, opaque */
+ s_t buf33[4][3][2]; /* compound */
+ hobj_ref_t buf43[4][3][2]; /* reference */
+ hvl_t buf53[4][3][2]; /* vlen */
+ int buf63[24][3]; /* array */
+ int buf73[4][3][2]; /* integer */
+ float buf83[4][3][2]; /* float */
if (make_diffs == 2)
dimarray[0] = 4;
/*-------------------------------------------------------------------------
- * H5S_SCALAR
- *-------------------------------------------------------------------------
- */
+ * H5S_SCALAR
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
scalar_data = 1;
@@ -7167,37 +7146,37 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
H5Sclose(sid);
/*-------------------------------------------------------------------------
- * 1D
- *-------------------------------------------------------------------------
- */
+ * 1D
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
buf1[i][j] = 'z';
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_dset(loc_id, 1, dims, "string", tid, buf1);
status = H5Tclose(tid);
for (i = 0; i < 2; i++)
buf1a[i] = buf1[i];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_dset(loc_id, 1, dims, "VLstring", tid, buf1a);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -7208,9 +7187,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++) {
@@ -7218,15 +7197,15 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
buf3[i].b = 0;
}
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_dset(loc_id, 1, dims, "opaque", tid, buf2);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -7239,27 +7218,27 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
- status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t) -1);
- status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf4[0], fid, dset_name, H5R_OBJECT, (hid_t)-1);
+ status = H5Rcreate(&buf4[1], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_dset(loc_id, 1, dims, "reference", H5T_STD_REF_OBJ, buf4);
}
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_DATASET_REGION dataset region reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_DATASET_REGION dataset region reference)
+ *-------------------------------------------------------------------------
+ */
gen_datareg(fid, make_diffs);
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
H5Tenum_insert(tid, "RED", (val = 0, &val));
H5Tenum_insert(tid, "GREEN", (val = 1, &val));
@@ -7267,30 +7246,29 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
- buf5[0].len = 1;
- buf5[0].p = HDmalloc(1 * sizeof(int));
- ((int *) buf5[0].p)[0] = 1;
- buf5[1].len = 2;
- buf5[1].p = HDmalloc(2 * sizeof(int));
- ((int *) buf5[1].p)[0] = 2;
- ((int *) buf5[1].p)[1] = 3;
+ buf5[0].len = 1;
+ buf5[0].p = HDmalloc(1 * sizeof(int));
+ ((int *)buf5[0].p)[0] = 1;
+ buf5[1].len = 2;
+ buf5[1].p = HDmalloc(2 * sizeof(int));
+ ((int *)buf5[1].p)[0] = 2;
+ ((int *)buf5[1].p)[1] = 3;
if (make_diffs) {
- ((int *) buf5[0].p)[0] = 0;
- ((int *) buf5[1].p)[0] = 0;
- ((int *) buf5[1].p)[1] = 0;
+ ((int *)buf5[0].p)[0] = 0;
+ ((int *)buf5[1].p)[0] = 0;
+ ((int *)buf5[1].p)[1] = 0;
}
- sid = H5Screate_simple(1, dims, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT,
- H5P_DEFAULT);
+ sid = H5Screate_simple(1, dims, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf5);
HDassert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
@@ -7300,9 +7278,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++)
@@ -7314,21 +7292,21 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
{
- double *dbuf; /* information to write */
- hid_t ldid = H5I_INVALID_HID; /* dataset ID */
- hid_t lsid = H5I_INVALID_HID; /* dataspace ID */
- hid_t ltid = H5I_INVALID_HID; /* datatype ID */
- size_t size;
- hsize_t sdims[] = { 1 };
- hsize_t tdims[] = { H5TOOLS_MALLOCSIZE / sizeof(double) + 1 };
- size_t jj;
+ double *dbuf; /* information to write */
+ hid_t ldid = H5I_INVALID_HID; /* dataset ID */
+ hid_t lsid = H5I_INVALID_HID; /* dataspace ID */
+ hid_t ltid = H5I_INVALID_HID; /* datatype ID */
+ size_t size;
+ hsize_t sdims[] = {1};
+ hsize_t tdims[] = {H5TOOLS_MALLOCSIZE / sizeof(double) + 1};
+ size_t jj;
/* allocate and initialize array data to write */
size = (H5TOOLS_MALLOCSIZE / sizeof(double) + 1) * sizeof(double);
- dbuf = (double *) HDmalloc(size);
+ dbuf = (double *)HDmalloc(size);
for (jj = 0; jj < (H5TOOLS_MALLOCSIZE / sizeof(double) + 1); jj++)
- dbuf[jj] = (double) jj;
+ dbuf[jj] = (double)jj;
if (make_diffs) {
dbuf[5] = 0;
@@ -7352,9 +7330,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
}
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
for (i = 0; i < 2; i++) {
@@ -7366,14 +7344,14 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
write_dset(loc_id, 1, dims, "float", H5T_NATIVE_FLOAT, buf8);
/*-------------------------------------------------------------------------
- * 2D
- *-------------------------------------------------------------------------
- */
+ * 2D
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
for (i = 0; i < 3; i++)
@@ -7382,8 +7360,8 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
buf12[i][j][k] = 'z';
}
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_dset(loc_id, 2, dims2, "string2D", tid, buf12);
status = H5Tclose(tid);
@@ -7391,15 +7369,15 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
for (j = 0; j < 2; j++)
buf12a[i][j] = buf12[i][j];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_dset(loc_id, 2, dims2, "VLstring2D", tid, buf12a);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
memset(buf22, 0, sizeof buf22);
@@ -7409,18 +7387,18 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_dset(loc_id, 2, dims2, "opaque2D", tid, buf22);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
memset(buf32, 0, sizeof buf32);
@@ -7432,21 +7410,21 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
for (i = 0; i < 3; i++)
for (j = 0; j < 2; j++)
- status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf42[i][j], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_dset(loc_id, 2, dims2, "reference2D", H5T_STD_REF_OBJ, buf42);
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
H5Tenum_insert(tid, "RED", (val = 0, &val));
@@ -7455,27 +7433,27 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
n = 0;
for (i = 0; i < 3; i++)
for (j = 0; j < 2; j++) {
- buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++) {
if (make_diffs)
- ((int *) buf52[i][j].p)[l] = 0;
+ ((int *)buf52[i][j].p)[l] = 0;
else
- ((int *) buf52[i][j].p)[l] = n++;
+ ((int *)buf52[i][j].p)[l] = n++;
}
}
- sid = H5Screate_simple(2, dims2, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(2, dims2, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf52);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
@@ -7485,9 +7463,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
if (make_diffs)
memset(buf62, 0, sizeof buf62);
@@ -7497,40 +7475,40 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_INTEGER, write a fill value
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER, write a fill value
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
memset(buf72, 0, sizeof buf72);
memset(buf82, 0, sizeof buf82);
}
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
status = H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillvalue);
- sid = H5Screate_simple(2, dims2, NULL);
- did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ sid = H5Screate_simple(2, dims2, NULL);
+ did = H5Dcreate2(loc_id, "integer2D", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
status = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf72);
status = H5Pclose(dcpl);
status = H5Dclose(did);
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
write_dset(loc_id, 2, dims2, "float2D", H5T_NATIVE_FLOAT, buf82);
/*-------------------------------------------------------------------------
- * 3D
- *-------------------------------------------------------------------------
- */
+ * 3D
+ *-------------------------------------------------------------------------
+ */
/*-------------------------------------------------------------------------
- * H5T_STRING
- *-------------------------------------------------------------------------
- */
+ * H5T_STRING
+ *-------------------------------------------------------------------------
+ */
if (make_diffs) {
for (i = 0; i < 4; i++)
@@ -7540,8 +7518,8 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
buf13[i][j][k][l] = 'z';
}
- tid = H5Tcopy(H5T_C_S1);
- status = H5Tset_size(tid, (size_t) STR_SIZE);
+ tid = H5Tcopy(H5T_C_S1);
+ status = H5Tset_size(tid, (size_t)STR_SIZE);
write_dset(loc_id, 3, dims3, "string3D", tid, buf13);
status = H5Tclose(tid);
@@ -7550,15 +7528,15 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
for (k = 0; k < 2; k++)
buf13a[i][j][k] = buf13[i][j][k];
- tid = H5Tcopy(H5T_C_S1);
+ tid = H5Tcopy(H5T_C_S1);
status = H5Tset_size(tid, H5T_VARIABLE);
write_dset(loc_id, 3, dims3, "VLstring3D", tid, buf13a);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_BITFIELD
- *-------------------------------------------------------------------------
- */
+ * H5T_BITFIELD
+ *-------------------------------------------------------------------------
+ */
n = 1;
for (i = 0; i < 4; i++)
@@ -7567,7 +7545,7 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
if (make_diffs)
buf23[i][j][k] = 0;
else
- buf23[i][j][k] = (char) n++;
+ buf23[i][j][k] = (char)n++;
}
tid = H5Tcopy(H5T_STD_B8LE);
@@ -7575,18 +7553,18 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_OPAQUE
- *-------------------------------------------------------------------------
- */
- tid = H5Tcreate(H5T_OPAQUE, (size_t) 1);
+ * H5T_OPAQUE
+ *-------------------------------------------------------------------------
+ */
+ tid = H5Tcreate(H5T_OPAQUE, (size_t)1);
status = H5Tset_tag(tid, "1-byte opaque type"); /* must set this */
write_dset(loc_id, 3, dims3, "opaque3D", tid, buf23);
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_COMPOUND
- *-------------------------------------------------------------------------
- */
+ * H5T_COMPOUND
+ *-------------------------------------------------------------------------
+ */
n = 1;
for (i = 0; i < 4; i++)
@@ -7597,7 +7575,7 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
buf33[i][j][k].b = 0.0F;
}
else {
- buf33[i][j][k].a = (char) n++;
+ buf33[i][j][k].a = (char)n++;
buf33[i][j][k].b = n++;
}
}
@@ -7609,22 +7587,22 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_REFERENCE (H5R_OBJECT object reference)
- *-------------------------------------------------------------------------
- */
+ * H5T_REFERENCE (H5R_OBJECT object reference)
+ *-------------------------------------------------------------------------
+ */
/* Create references to dataset */
if (dset_name) {
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++)
- status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t) -1);
+ status = H5Rcreate(&buf43[i][j][k], fid, dset_name, H5R_OBJECT, (hid_t)-1);
write_dset(loc_id, 3, dims3, "reference3D", H5T_STD_REF_OBJ, buf43);
}
/*-------------------------------------------------------------------------
- * H5T_ENUM
- *-------------------------------------------------------------------------
- */
+ * H5T_ENUM
+ *-------------------------------------------------------------------------
+ */
tid = H5Tcreate(H5T_ENUM, sizeof(e_t));
H5Tenum_insert(tid, "RED", (val = 0, &val));
@@ -7633,28 +7611,28 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_VLEN
- *-------------------------------------------------------------------------
- */
+ * H5T_VLEN
+ *-------------------------------------------------------------------------
+ */
/* Allocate and initialize VL dataset to write */
n = 0;
for (i = 0; i < 4; i++)
for (j = 0; j < 3; j++)
for (k = 0; k < 2; k++) {
- buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++) {
if (make_diffs)
- ((int *) buf53[i][j][k].p)[l] = 0;
+ ((int *)buf53[i][j][k].p)[l] = 0;
else
- ((int *) buf53[i][j][k].p)[l] = n++;
+ ((int *)buf53[i][j][k].p)[l] = n++;
}
}
- sid = H5Screate_simple(3, dims3, NULL);
- tid = H5Tvlen_create(H5T_NATIVE_INT);
- did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid = H5Screate_simple(3, dims3, NULL);
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+ did = H5Dcreate2(loc_id, "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf53);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
@@ -7664,9 +7642,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Sclose(sid);
/*-------------------------------------------------------------------------
- * H5T_ARRAY
- *-------------------------------------------------------------------------
- */
+ * H5T_ARRAY
+ *-------------------------------------------------------------------------
+ */
n = 1;
for (i = 0; i < 24; i++)
@@ -7682,9 +7660,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
status = H5Tclose(tid);
/*-------------------------------------------------------------------------
- * H5T_INTEGER and H5T_FLOAT
- *-------------------------------------------------------------------------
- */
+ * H5T_INTEGER and H5T_FLOAT
+ *-------------------------------------------------------------------------
+ */
n = 1;
f = 1;
for (i = 0; i < 4; i++)
@@ -7714,44 +7692,43 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
*-------------------------------------------------------------------------
*/
-static
-void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */)
+static void
+gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */)
{
/* data dataset */
- hid_t did1 = H5I_INVALID_HID; /* dataset ID */
- hid_t sid1 = H5I_INVALID_HID; /* dataspace ID */
- hsize_t dims1[2] = { 10, 10 };/* dimensions */
- int *buf; /* dataset buffer */
+ hid_t did1 = H5I_INVALID_HID; /* dataset ID */
+ hid_t sid1 = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims1[2] = {10, 10}; /* dimensions */
+ int * buf; /* dataset buffer */
/* reference dataset */
- hid_t did2 = H5I_INVALID_HID; /* dataset ID */
- hid_t sid2 = H5I_INVALID_HID; /* dataspace ID */
- hsize_t dims2[] = { 2 }; /* 2 references */
- hdset_reg_ref_t *rbuf; /* buffer for write the references */
- hsize_t start[10]; /* starting location of hyperslab */
- hsize_t count[10]; /* element count of hyperslab */
- hsize_t coord[5][2]; /* coordinates for point selection */
- herr_t status;
- int i;
+ hid_t did2 = H5I_INVALID_HID; /* dataset ID */
+ hid_t sid2 = H5I_INVALID_HID; /* dataspace ID */
+ hsize_t dims2[] = {2}; /* 2 references */
+ hdset_reg_ref_t *rbuf; /* buffer for write the references */
+ hsize_t start[10]; /* starting location of hyperslab */
+ hsize_t count[10]; /* element count of hyperslab */
+ hsize_t coord[5][2]; /* coordinates for point selection */
+ herr_t status;
+ int i;
/* allocate the buffer for write the references */
- rbuf = (hdset_reg_ref_t *) HDcalloc((size_t )2, sizeof(hdset_reg_ref_t));
+ rbuf = (hdset_reg_ref_t *)HDcalloc((size_t)2, sizeof(hdset_reg_ref_t));
/* allocate the buffer for write the data dataset */
- buf = (int *) HDmalloc(10 * 10 * sizeof(int));
+ buf = (int *)HDmalloc(10 * 10 * sizeof(int));
for (i = 0; i < 10 * 10; i++)
buf[i] = i;
/* create the data dataset */
- sid1 = H5Screate_simple(2, dims1, NULL);
- did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ sid1 = H5Screate_simple(2, dims1, NULL);
+ did1 = H5Dcreate2(fid, "dsetref", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
HDassert(status >= 0);
/* create the reference dataset */
sid2 = H5Screate_simple(1, dims2, NULL);
- did2 = H5Dcreate2(fid, "refreg", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ did2 = H5Dcreate2(fid, "refreg", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* create the references */
/* select hyperslab for first reference */
@@ -7794,7 +7771,7 @@ void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */)
coord[4][0] = 1;
coord[4][1] = 7;
}
- H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t) 5, (const hsize_t *) coord);
+ H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)5, (const hsize_t *)coord);
H5Sget_select_npoints(sid1);
/* store second dataset region */
@@ -7826,25 +7803,25 @@ void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */)
*
*-------------------------------------------------------------------------
*/
-static
-int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers */)
+static int
+test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers */)
{
- hid_t did = H5I_INVALID_HID;
- hid_t fid = H5I_INVALID_HID;
- hid_t f_sid = H5I_INVALID_HID;
- hid_t m_sid = H5I_INVALID_HID;
- hid_t tid = H5I_INVALID_HID;
- hid_t dcpl = H5I_INVALID_HID;
- hsize_t dims[1] = { GBLL }; /* dataset dimensions */
- hsize_t hs_size[1] = { GBLL / (1024 * 1024) }; /* hyperslab dimensions */
- hsize_t chunk_dims[1] = { GBLL / 1024 }; /* chunk dimensions */
+ hid_t did = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t f_sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ hsize_t dims[1] = {GBLL}; /* dataset dimensions */
+ hsize_t hs_size[1] = {GBLL / (1024 * 1024)}; /* hyperslab dimensions */
+ hsize_t chunk_dims[1] = {GBLL / 1024}; /* chunk dimensions */
hsize_t hs_start[1];
- size_t size;
- size_t nelmts = (size_t)GBLL / (1024 * 1024); /* elements in each hyperslab */
- char fillvalue = -1;
- char *buf = NULL;
- int i, j, s;
- char c;
+ size_t size;
+ size_t nelmts = (size_t)GBLL / (1024 * 1024); /* elements in each hyperslab */
+ char fillvalue = -1;
+ char * buf = NULL;
+ int i, j, s;
+ char c;
/* create */
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -7866,8 +7843,8 @@ int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buff
goto out;
/* create a evenly divided buffer from 0 to 127 */
- buf = (char *) HDmalloc((size_t)(nelmts * size));
- s = 1024 * 1024 / 127;
+ buf = (char *)HDmalloc((size_t)(nelmts * size));
+ s = 1024 * 1024 / 127;
for (i = 0, j = 0, c = 0; i < 1024 * 1024; j++, i++) {
if (j == s) {
c++;
@@ -7881,7 +7858,7 @@ int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buff
if (make_diffs && i == 512 * 512)
HDmemset(buf, 0, nelmts);
- hs_start[0] = (unsigned long long) i * GBLL / (1024 * 1024);
+ hs_start[0] = (unsigned long long)i * GBLL / (1024 * 1024);
if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0)
goto out;
@@ -7908,13 +7885,15 @@ int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buff
return 0;
out:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Sclose(f_sid);
H5Sclose(m_sid);
H5Dclose(did);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
}
@@ -7925,8 +7904,8 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
-int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf)
+static int
+write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf)
{
hid_t aid = H5I_INVALID_HID;
hid_t sid = H5I_INVALID_HID;
@@ -7972,33 +7951,34 @@ write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, v
hid_t sid = H5I_INVALID_HID;
/* create a space */
- if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
+ if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
PROGRAM_ERROR
/* create the dataset */
- if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
PROGRAM_ERROR
/* write */
- if(buf)
- if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (buf)
+ if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
PROGRAM_ERROR
/* close */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
PROGRAM_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
PROGRAM_ERROR
return SUCCEED;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return FAIL;
} /* end write_dset() */
-
diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c
index c473c8b..549d422 100644
--- a/tools/h5diff/ph5diff_main.c
+++ b/tools/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);
}
-