summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5diff/h5diff_common.c45
-rw-r--r--tools/src/h5dump/h5dump.h4
-rw-r--r--tools/src/h5dump/h5dump_extern.h4
-rw-r--r--tools/src/h5dump/h5dump_xml.c450
-rw-r--r--tools/src/h5ls/h5ls.c2
-rw-r--r--tools/src/h5repack/h5repack.c885
-rw-r--r--tools/src/h5repack/h5repack.h24
-rw-r--r--tools/src/h5repack/h5repack_copy.c233
-rw-r--r--tools/src/h5repack/h5repack_main.c87
-rw-r--r--tools/src/h5repack/h5repack_refs.c46
-rw-r--r--tools/src/h5repack/h5repack_verify.c19
11 files changed, 914 insertions, 885 deletions
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index 5437803..0537b9f 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -56,7 +56,7 @@ static struct long_options l_opts[] = {
static void check_options(diff_opt_t* options)
{
/*--------------------------------------------------------------
- * check for mutually exclusive options
+ * check for mutually exclusive options
*--------------------------------------------------------------*/
/* check between -d , -p, --use-system-epsilon.
@@ -127,13 +127,13 @@ void parse_command_line(int argc,
h5diff_exit(EXIT_SUCCESS);
case 'v':
options->m_verbose = 1;
- /* This for loop is for handling style like
+ /* This for loop is for handling style like
* -v, -v1, --verbose, --verbose=1.
*/
for (i = 1; i < argc; i++)
- {
- /*
- * short opt
+ {
+ /*
+ * short opt
*/
if (!strcmp (argv[i], "-v")) /* no arg */
{
@@ -145,10 +145,10 @@ void parse_command_line(int argc,
{
options->m_verbose_level = atoi(&argv[i][2]);
break;
- }
+ }
- /*
- * long opt
+ /*
+ * long opt
*/
if (!strcmp (argv[i], "--verbose")) /* no arg */
{
@@ -177,7 +177,7 @@ void parse_command_line(int argc,
break;
case 'E':
options->exclude_path = 1;
-
+
/* create linked list of excluding objects */
if( (exclude_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL)
{
@@ -189,8 +189,8 @@ void parse_command_line(int argc,
exclude_node->obj_path = (char*)opt_arg;
exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN;
exclude_prev = exclude_head;
-
- if (NULL == exclude_head)
+
+ if (NULL == exclude_head)
{
exclude_head = exclude_node;
exclude_head->next = NULL;
@@ -202,7 +202,7 @@ void parse_command_line(int argc,
exclude_node->next = NULL;
exclude_prev->next = exclude_node;
- }
+ }
break;
case 'd':
options->d=1;
@@ -458,7 +458,7 @@ check_d_input( const char *str )
void usage(void)
{
- printf("usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] \n");
+ printf("usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]\n");
printf(" file1 File name of the first HDF5 file\n");
printf(" file2 File name of the second HDF5 file\n");
printf(" [obj1] Name of an HDF5 object, in absolute path\n");
@@ -519,19 +519,22 @@ void usage(void)
printf(" -n C, --count=C\n");
printf(" Print differences up to C. C must be a positive integer.\n");
printf(" -d D, --delta=D\n");
- printf(" Print difference if (|a-b| > D). D must be a positive number.\n");
+ printf(" Print difference if (|a-b| > D). D must be a positive number. Where a\n");
+ printf(" is the data point value in file1 and b is the data point value in file2.\n");
printf(" Can not use with '-p' or '--use-system-epsilon'.\n");
printf(" -p R, --relative=R\n");
- printf(" Print difference if (|(a-b)/b| > R). R must be a positive number.\n");
+ printf(" Print difference if (|(a-b)/b| > R). R must be a positive number. Where a\n");
+ printf(" is the data point value in file1 and b is the data point value in file2.\n");
printf(" Can not use with '-d' or '--use-system-epsilon'.\n");
printf(" --use-system-epsilon\n");
- printf(" Print difference if (|a-b| > EPSILON), EPSILON is system defined value.\n");
+ printf(" Print difference if (|a-b| > EPSILON), EPSILON is system defined value. Where a\n");
+ printf(" is the data point value in file1 and b is the data point value in file2.\n");
printf(" If the system epsilon is not defined,one of the following predefined\n");
printf(" values will be used:\n");
printf(" FLT_EPSILON = 1.19209E-07 for floating-point type\n");
printf(" DBL_EPSILON = 2.22045E-16 for double precision type\n");
printf(" Can not use with '-p' or '-d'.\n");
- printf(" --exclude-path \"path\" \n");
+ printf(" --exclude-path \"path\"\n");
printf(" Exclude the specified path to an object when comparing files or groups.\n");
printf(" If a group is excluded, all member objects will also be excluded.\n");
printf(" The specified path is excluded wherever it occurs.\n");
@@ -570,15 +573,15 @@ void usage(void)
printf("\n");
printf(" Object comparison:\n");
- printf(" 1) Groups \n");
+ printf(" 1) Groups\n");
printf(" First compares the names of member objects (relative path, from the\n");
printf(" specified group) and generates a report of objects that appear in only\n");
printf(" one group or in both groups. Common objects are then compared recursively.\n");
- printf(" 2) Datasets \n");
+ printf(" 2) Datasets\n");
printf(" Array rank and dimensions, datatypes, and data values are compared.\n");
- printf(" 3) Datatypes \n");
+ printf(" 3) Datatypes\n");
printf(" The comparison is based on the return value of H5Tequal.\n");
- printf(" 4) Symbolic links \n");
+ printf(" 4) Symbolic links\n");
printf(" The paths to the target objects are compared.\n");
printf(" (The option --follow-symlinks overrides the default behavior when\n");
printf(" symbolic links are compared.).\n");
diff --git a/tools/src/h5dump/h5dump.h b/tools/src/h5dump/h5dump.h
index 211fd14..801f60d 100644
--- a/tools/src/h5dump/h5dump.h
+++ b/tools/src/h5dump/h5dump.h
@@ -78,10 +78,6 @@ int include_attrs = TRUE; /* Display attributes */
int display_vds_first = FALSE; /* vds display to all by default*/
int vds_gap_size = 0; /* vds skip missing files default is none */
-/* sort parameters */
-H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */
-H5_iter_order_t sort_order = H5_ITER_INC; /*sort_order [ascending | descending] */
-
#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
#define PACKED_BITS_SIZE_MAX (8*sizeof(long long)) /* Maximum bits size of integer types of packed-bits */
/* mask list for packed bits */
diff --git a/tools/src/h5dump/h5dump_extern.h b/tools/src/h5dump/h5dump_extern.h
index 22aca73..00d3bd2 100644
--- a/tools/src/h5dump/h5dump_extern.h
+++ b/tools/src/h5dump/h5dump_extern.h
@@ -77,10 +77,6 @@ extern int include_attrs; /* Display attributes */
extern int display_vds_first; /* vds display to first missing */
extern int vds_gap_size; /* vds skip missing files */
-/* sort parameters */
-extern H5_index_t sort_by; /*sort_by [creation_order | name] */
-extern H5_iter_order_t sort_order; /*sort_order [ascending | descending] */
-
#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
#define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */
/* mask list for packed bits */
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 49d1ba8..1c3978d 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -108,7 +108,7 @@ static h5tool_format_t xml_dataformat = {
/* internal functions */
-static int xml_name_to_XID(const char *, char *, int , int );
+static int xml_name_to_XID(const char *, char *, int , int );
/* internal functions used by XML option */
static void xml_print_datatype(hid_t, unsigned);
@@ -122,34 +122,26 @@ static char *xml_escape_the_name(const char *);
* Function: xml_dump_all_cb
*
* Purpose: function callback called by H5Literate,
- * displays everything in the specified object
+ * displays everything in the specified object
*
* Return: Success: SUCCEED
*
* Failure: FAIL
*
* Programmer: Ruey-Hsia Li
- *
- * Modifications:
- * RMcG, November 2000
- * Added XML support. Also, optionally checks the op_data argument
- *
- * PVN, May 2008
- * Dump external links
- *
*-------------------------------------------------------------------------
*/
static herr_t
xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
{
- hid_t obj;
- herr_t ret = SUCCEED;
- char *obj_path = NULL; /* Full path of object */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
+ hid_t obj;
+ herr_t ret = SUCCEED;
+ char *obj_path = NULL; /* Full path of object */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
h5tool_format_t *outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -157,7 +149,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -180,7 +172,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
if(!obj_path) {
ret = FAIL;
goto done;
- }
+ }
HDstrcpy(obj_path, prefix);
HDstrcat(obj_path, "/");
@@ -268,7 +260,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
ret = FAIL;
H5Dclose(obj);
goto done;
- }
+ }
else if(found_obj->displayed) {
/* the XML version */
char *t_obj_path = xml_escape_the_name(obj_path);
@@ -330,14 +322,14 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
H5Dclose(obj);
goto done;
- }
+ }
else
found_obj->displayed = TRUE;
} /* end if */
dump_function_table->dump_dataset_function(obj, name, NULL);
H5Dclose(obj);
- }
+ }
else {
error_msg("unable to dump dataset \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
@@ -350,7 +342,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
error_msg("unable to dump datatype \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- }
+ }
else {
dump_function_table->dump_named_datatype_function(obj, name);
H5Tclose(obj);
@@ -377,7 +369,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
error_msg("unable to get link value\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- }
+ }
else {
/* print the value of a soft link */
/* XML */
@@ -426,7 +418,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
parentxid, /* Parents */
t_prefix); /* H5ParentPaths */
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
+ }
else {
/* dangling link -- omit from xml attributes */
ctx.need_prefix = TRUE;
@@ -510,7 +502,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
parentxid, /* Parents */
t_prefix); /* H5ParentPaths */
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
+
HDfree(t_prefix);
HDfree(t_name);
HDfree(t_filename);
@@ -556,7 +548,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
parentxid, /* Parents */
t_prefix); /* H5ParentPaths */
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
+
HDfree(t_prefix);
HDfree(t_name);
HDfree(t_obj_path);
@@ -598,18 +590,18 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
objno = ref_path_table_gen_fake(str);
sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
return 0;
- }
+ }
else {
return 1;
}
}
- }
+ }
else {
if (gen) {
objno = ref_path_table_gen_fake(str);
sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
return 0;
- }
+ }
else {
return 1;
}
@@ -636,9 +628,6 @@ static const char *apos = "&apos;";
* Return: The revised string.
*
* Programmer: REMcG
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static char *
@@ -691,23 +680,23 @@ xml_escape_the_name(const char *str)
if (*cp == '\'') {
HDstrncpy(ncp, apos, ncp_len);
esc_len = HDstrlen(apos);
- }
+ }
else if (*cp == '<') {
HDstrncpy(ncp, lt, ncp_len);
esc_len = HDstrlen(lt);
- }
+ }
else if (*cp == '>') {
HDstrncpy(ncp, gt, ncp_len);
esc_len = HDstrlen(gt);
- }
+ }
else if (*cp == '\"') {
HDstrncpy(ncp, quote, ncp_len);
esc_len = HDstrlen(quote);
- }
+ }
else if (*cp == '&') {
HDstrncpy(ncp, amp, ncp_len);
esc_len = HDstrlen(amp);
- }
+ }
else {
*ncp = *cp;
esc_len = 1;
@@ -730,9 +719,6 @@ xml_escape_the_name(const char *str)
* Return: The revised string.
*
* Programmer: REMcG
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static char *
@@ -838,9 +824,6 @@ xml_escape_the_string(const char *str, int slen)
* Return: void
*
* Programmer: REMcG
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -865,12 +848,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
size_t mpos;
size_t msize;
int nmembs;
- htri_t is_vlstr=FALSE;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ htri_t is_vlstr = FALSE;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -878,7 +861,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -923,7 +906,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"/%s\"/>",
xmlnsprefix, dtxid);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
+ }
else {
/* point to the NDT by name */
char *t_objname = xml_escape_the_name(found_obj->objname);
@@ -939,7 +922,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
HDfree(t_objname);
}
HDfree(dtxid);
- }
+ }
else {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -950,7 +933,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_setstatus(EXIT_FAILURE);
}
- }
+ }
else {
switch (H5Tget_class(type)) {
case H5T_INTEGER:
@@ -988,9 +971,9 @@ xml_print_datatype(hid_t type, unsigned in_group)
h5tools_str_append(&buffer, "ERROR_UNKNOWN");
break;
} /* end switch */
-
+
h5tools_str_append(&buffer, "\" Sign=\"");
-
+
switch (sgn) {
case H5T_SGN_NONE:
h5tools_str_append(&buffer, "false");
@@ -1004,7 +987,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
h5tools_str_append(&buffer, "ERROR_UNKNOWN");
break;
} /* end switch */
-
+
h5tools_str_append(&buffer, "\" Size=\"");
sz = H5Tget_size(type);
h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
@@ -1043,7 +1026,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix);
-
+
switch (ord) {
case H5T_ORDER_LE:
h5tools_str_append(&buffer, "LE");
@@ -1060,7 +1043,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
default:
h5tools_str_append(&buffer, "ERROR_UNKNOWN");
} /* end switch */
-
+
h5tools_str_append(&buffer, "\" Size=\"");
sz = H5Tget_size(type);
h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
@@ -1182,7 +1165,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix);
-
+
switch (ord) {
case H5T_ORDER_LE:
h5tools_str_append(&buffer, "LE");
@@ -1197,7 +1180,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
default:
h5tools_str_append(&buffer, "ERROR_UNKNOWN");
} /* end switch */
-
+
size = H5Tget_size(type);
h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
@@ -1559,19 +1542,16 @@ xml_print_datatype(hid_t type, unsigned in_group)
* Return: void
*
* Programmer: REMcG
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
xml_dump_datatype(hid_t type)
{
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
h5tool_format_t *outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1579,7 +1559,7 @@ xml_dump_datatype(hid_t type)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -1629,7 +1609,7 @@ xml_dump_datatype(hid_t type)
h5tools_str_append(&buffer, "<%sNamedDataTypePtr OBJ-XID=\"%s\"/>",
xmlnsprefix, dtxid);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
+ }
else {
/* pointer to a named datatype already in XML */
char *t_objname = xml_escape_the_name(found_obj->objname);
@@ -1645,7 +1625,7 @@ xml_dump_datatype(hid_t type)
HDfree(t_objname);
}
HDfree(dtxid);
- }
+ }
else {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -1692,25 +1672,22 @@ xml_dump_datatype(hid_t type)
* Return: void
*
* Programmer: REMcG
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
xml_dump_dataspace(hid_t space)
{
- hsize_t size[H5DUMP_MAX_RANK];
- hsize_t maxsize[H5DUMP_MAX_RANK];
- int i;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
+ hsize_t size[H5DUMP_MAX_RANK];
+ hsize_t maxsize[H5DUMP_MAX_RANK];
+ int i;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
h5tool_format_t *outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
-
- int ndims = H5Sget_simple_extent_dims(space, size, maxsize);
- H5S_class_t space_type = H5Sget_simple_extent_type(space);
+ hsize_t curr_pos = 0; /* total data element position */
+
+ int ndims = H5Sget_simple_extent_dims(space, size, maxsize);
+ H5S_class_t space_type = H5Sget_simple_extent_type(space);
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1718,7 +1695,7 @@ xml_dump_dataspace(hid_t space)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -1784,7 +1761,7 @@ xml_dump_dataspace(hid_t space)
h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"UNLIMITED\"/>",
xmlnsprefix,size[i]);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
+ }
else if (maxsize[i] == (hsize_t) 0) {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -1794,7 +1771,7 @@ xml_dump_dataspace(hid_t space)
h5tools_str_append(&buffer, "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
xmlnsprefix,size[i], size[i]);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
+ }
else {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -1868,9 +1845,6 @@ xml_dump_dataspace(hid_t space)
* Return: void
*
* Programmer: REMcG
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
@@ -1886,19 +1860,19 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
int status = -1;
void *buf = NULL;
hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
h5tool_format_t *outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
/* Print all the values. */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -1922,7 +1896,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
@@ -1932,14 +1906,14 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
ctx.indent_level--;
-
+
dump_indent += COL;
ctx.indent_level++;
@@ -1957,7 +1931,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
datactx.cur_column = ctx.cur_column;
status = h5tools_dump_dset(rawoutstream, outputformat, &datactx, obj_id, NULL);
}
- }
+ }
else {
/* Attribute data */
type = H5Aget_type(obj_id);
@@ -1970,15 +1944,15 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
*/
status = xml_print_refs(obj_id, ATTRIBUTE_DATA);
H5Tclose(type);
- }
+ }
else if (H5Tget_class(type) == H5T_STRING) {
status = xml_print_strs(obj_id, ATTRIBUTE_DATA);
- }
+ }
else { /* all other data */
/* VL data special information */
unsigned int vl_data = 0; /* contains VL datatypes */
-
- p_type = h5tools_get_native_type(type);
+
+ p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
/* Check if we have VL data in the dataset's datatype */
if (h5tools_detect_vlen(p_type) == TRUE)
@@ -1995,7 +1969,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
buf = HDmalloc((size_t)(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type))));
HDassert(buf);
-
+
if (H5Aread(obj_id, p_type, buf) >= 0) {
h5tools_context_t datactx;
HDmemset(&datactx, 0, sizeof(datactx));
@@ -2020,7 +1994,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "Unable to print data.");
@@ -2036,7 +2010,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
ctx.indent_level++;
ctx.need_prefix = TRUE;
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataFromFile>",xmlnsprefix);
@@ -2046,7 +2020,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
@@ -2063,9 +2037,6 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
* Return: herr_t
*
* Programmer: REMcG
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2077,11 +2048,11 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
hid_t space = -1;
H5S_class_t space_type;
hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
h5tool_format_t *outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
-
+
char *t_aname = xml_escape_the_name(attr_name);
/* setup */
@@ -2090,7 +2061,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -2110,7 +2081,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sAttribute Name=\"%s\">", xmlnsprefix, t_aname);
@@ -2146,7 +2117,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
@@ -2154,7 +2125,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- Time data not yet implemented. -->");
@@ -2162,7 +2133,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
@@ -2170,7 +2141,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<hdf5:Data>");
@@ -2178,7 +2149,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
@@ -2191,7 +2162,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
case H5T_COMPOUND:
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- Note: format of compound data not specified -->");
@@ -2202,7 +2173,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
case H5T_REFERENCE:
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
@@ -2210,7 +2181,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
if (!H5Tequal(type, H5T_STD_REF_OBJ)) {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- Note: Region references not supported -->");
@@ -2218,7 +2189,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoData />", xmlnsprefix);
@@ -2227,7 +2198,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
else {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataFromFile>", xmlnsprefix);
@@ -2237,7 +2208,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
@@ -2246,7 +2217,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
@@ -2256,7 +2227,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
case H5T_VLEN:
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- Note: format of VL data not specified -->");
@@ -2271,7 +2242,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
default:
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
@@ -2279,7 +2250,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- Unknown datatype: %d -->", H5Tget_class(type));
@@ -2287,7 +2258,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
@@ -2295,7 +2266,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
@@ -2308,7 +2279,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
* Or dataspace is H5S_NULL. */
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sData>", xmlnsprefix);
@@ -2318,7 +2289,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNoData/>", xmlnsprefix);
@@ -2328,7 +2299,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sData>", xmlnsprefix);
@@ -2343,7 +2314,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix);
@@ -2358,7 +2329,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<!-- h5dump error: unable to open attribute. -->");
@@ -2368,14 +2339,14 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sAttribute>", xmlnsprefix);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
-
+
h5tools_setstatus(EXIT_FAILURE);
return FAIL;
}
@@ -2389,17 +2360,14 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
* Return: herr_t
*
* Programmer: REMcG
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
void
xml_dump_named_datatype(hid_t type, const char *name)
{
hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
h5tool_format_t *outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
char *tmp;
@@ -2420,7 +2388,7 @@ xml_dump_named_datatype(hid_t type, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -2458,7 +2426,7 @@ xml_dump_named_datatype(hid_t type, const char *name)
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
@@ -2467,13 +2435,13 @@ xml_dump_named_datatype(hid_t type, const char *name)
name, dtxid,
parentxid, HDstrcmp(prefix,"") ? t_prefix : "/");
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
+ }
else {
H5O_info_t oinfo; /* Object info */
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" "
@@ -2496,7 +2464,7 @@ xml_dump_named_datatype(hid_t type, const char *name)
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
- }
+ }
else if(found_obj->displayed) {
/* We have already printed this named datatype, print it as a
* NamedDatatypePtr
@@ -2505,29 +2473,29 @@ xml_dump_named_datatype(hid_t type, const char *name)
char *t_objname = xml_escape_the_name(found_obj->objname);
ctx.indent_level++;
-
+
xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sNamedDatatypePtr OBJ-XID=\"%s\" H5Path=\"%s\"/>", xmlnsprefix, pointerxid, t_objname);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
+
ctx.indent_level--;
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sNamedDataType>", xmlnsprefix);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
goto done;
- }
+ }
else
found_obj->displayed = TRUE;
}
@@ -2538,7 +2506,7 @@ xml_dump_named_datatype(hid_t type, const char *name)
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
@@ -2549,10 +2517,10 @@ xml_dump_named_datatype(hid_t type, const char *name)
xml_print_datatype(type,1);
ctx.indent_level--;
dump_indent -= COL;
-
+
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
@@ -2563,7 +2531,7 @@ xml_dump_named_datatype(hid_t type, const char *name)
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sNamedDataType>",xmlnsprefix);
@@ -2589,11 +2557,6 @@ done:
* Return: void
*
* Programmer: REMcG
- *
- * Modifications:
- * Pedro Vicente, October 9, 2007
- * added parameters to H5A(L)iterate to allow for other iteration orders
- *
*-------------------------------------------------------------------------
*/
void
@@ -2611,11 +2574,11 @@ xml_dump_group(hid_t gid, const char *name)
char *cp = NULL;
char *tmp = NULL;
char *par = NULL;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
error_msg("error in getting group creation property list ID\n");
@@ -2645,7 +2608,7 @@ xml_dump_group(hid_t gid, const char *name)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -2733,7 +2696,7 @@ xml_dump_group(hid_t gid, const char *name)
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
HDfree(t_objname);
HDfree(par_name);
-
+
ctx.indent_level++;
t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */
@@ -2751,7 +2714,7 @@ xml_dump_group(hid_t gid, const char *name)
xmlnsprefix,
ptrstr, t_objname, parentxid, par_name);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
+
ctx.indent_level--;
HDfree(t_objname);
@@ -2797,7 +2760,7 @@ xml_dump_group(hid_t gid, const char *name)
found_obj->displayed = TRUE;
/* 1. do all the attributes of the group */
-
+
ctx.indent_level++;
dump_indent += COL;
@@ -2880,7 +2843,7 @@ xml_dump_group(hid_t gid, const char *name)
HDfree(parentxid);
/* 1. do all the attributes of the group */
-
+
ctx.indent_level++;
dump_indent += COL;
@@ -2936,7 +2899,7 @@ xml_dump_group(hid_t gid, const char *name)
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
-
+
if(par)
HDfree(par);
if(tmp)
@@ -2951,27 +2914,24 @@ xml_dump_group(hid_t gid, const char *name)
* Return: void
*
* Programmer: REMcG
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
xml_print_refs(hid_t did, int source)
{
- herr_t e;
- hid_t type = -1;
- hid_t space = -1;
- hssize_t ssiz = -1;
- hsize_t i;
- size_t tsiz;
- hobj_ref_t *refbuf = NULL;
- char *buf = NULL;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
+ herr_t e;
+ hid_t type = -1;
+ hid_t space = -1;
+ hssize_t ssiz = -1;
+ hsize_t i;
+ size_t tsiz;
+ hobj_ref_t *refbuf = NULL;
+ char *buf = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
h5tool_format_t *outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
if (source == DATASET_DATA) {
type = H5Dget_type(did);
@@ -3031,7 +2991,7 @@ xml_print_refs(hid_t did, int source)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -3085,7 +3045,7 @@ xml_print_refs(hid_t did, int source)
H5Tclose(type);
H5Sclose(space);
return SUCCEED;
-
+
error:
if(buf)
HDfree(buf);
@@ -3105,30 +3065,27 @@ error:
* Return: void
*
* Programmer: REMcG
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
xml_print_strs(hid_t did, int source)
{
- herr_t e;
- hid_t type = -1;
- hid_t space = -1;
- hssize_t ssiz = -1;
- htri_t is_vlstr = FALSE;
- size_t tsiz = 0;
- hsize_t i;
- size_t str_size = 0;
- char *bp = NULL;
- char *onestring = NULL;
- void *buf = NULL;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
+ herr_t e;
+ hid_t type = -1;
+ hid_t space = -1;
+ hssize_t ssiz = -1;
+ htri_t is_vlstr = FALSE;
+ size_t tsiz = 0;
+ hsize_t i;
+ size_t str_size = 0;
+ char *bp = NULL;
+ char *onestring = NULL;
+ void *buf = NULL;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
h5tool_format_t *outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
if (source == DATASET_DATA)
type = H5Dget_type(did);
@@ -3184,7 +3141,7 @@ xml_print_strs(hid_t did, int source)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -3252,7 +3209,7 @@ xml_print_strs(hid_t did, int source)
H5Tclose(type);
H5Sclose(space);
return SUCCEED;
-
+
error:
if(buf)
HDfree(buf);
@@ -3273,26 +3230,23 @@ error:
* Return: void
*
* Programmer: REMcG
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
check_filters(hid_t dcpl)
{
- int nfilt;
- int i;
- H5Z_filter_t filter;
- char namebuf[120];
- size_t cd_nelmts = 20;
- unsigned int cd_values[20];
- unsigned int flags;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
+ int nfilt;
+ int i;
+ H5Z_filter_t filter;
+ char namebuf[120];
+ size_t cd_nelmts = 20;
+ unsigned int cd_values[20];
+ unsigned int flags;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
h5tool_format_t *outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -3300,7 +3254,7 @@ check_filters(hid_t dcpl)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -3423,16 +3377,16 @@ check_filters(hid_t dcpl)
static void
xml_dump_fill_value(hid_t dcpl, hid_t type)
{
- size_t sz;
- size_t i;
- hsize_t space;
- void *buf;
- char *name;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
+ size_t sz;
+ size_t i;
+ hsize_t space;
+ void *buf;
+ char *name;
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
h5tool_format_t *outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -3440,7 +3394,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -3452,7 +3406,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
- else
+ else
string_dataformat.line_ncols = h5tools_nCols;
string_dataformat.do_escape = display_escape;
@@ -3764,11 +3718,6 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
* Return: void
*
* Programmer: REMcG
- *
- * Modifications:
- * Pedro Vicente, October 9, 2007
- * added parameters to H5Aiterate2 to allow for other iteration orders
- *
*-------------------------------------------------------------------------
*/
void
@@ -3791,11 +3740,11 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s
char *t_prefix;
unsigned attr_crt_order_flags;
h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
+ h5tools_context_t ctx; /* print context */
h5tool_format_t *outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
-
+ hsize_t curr_pos = 0; /* total data element position */
+
char *rstr = (char*) HDmalloc((size_t)100);
char *pstr = (char*) HDmalloc((size_t)100);
@@ -3814,7 +3763,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s
t_name = xml_escape_the_name(name);
t_tmp = xml_escape_the_name(tmp);
t_prefix = xml_escape_the_name(prefix);
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -3925,7 +3874,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s
ctx.indent_level--;
dump_indent -= COL;
-
+
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -4376,9 +4325,6 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s
* Return: void
*
* Programmer: REMcG
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -4392,11 +4338,11 @@ xml_print_enum(hid_t type)
size_t dst_size; /*destination value type size */
unsigned i; /*miscellaneous counters */
size_t j;
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t ctx; /* print context */
- h5tool_format_t *outputformat = &xml_dataformat;
- h5tool_format_t string_dataformat;
- hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t ctx; /* print context */
+ h5tool_format_t *outputformat = &xml_dataformat;
+ h5tool_format_t string_dataformat;
+ hsize_t curr_pos = 0; /* total data element position */
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -4404,7 +4350,7 @@ xml_print_enum(hid_t type)
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -4455,11 +4401,11 @@ xml_print_enum(hid_t type)
if (H5T_SGN_NONE == H5Tget_sign(type)) {
native = H5T_NATIVE_ULLONG;
- }
+ }
else {
native = H5T_NATIVE_LLONG;
}
- }
+ }
else {
dst_size = H5Tget_size(type);
}
@@ -4530,11 +4476,11 @@ xml_print_enum(hid_t type)
for (j = 0; j < dst_size; j++)
h5tools_str_append(&buffer, "%02x", value[i * dst_size + j]);
- }
+ }
else if (H5T_SGN_NONE == H5Tget_sign(native)) {
h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "u", *((unsigned long long *)
((void *) (value + i * dst_size))));
- }
+ }
else {
h5tools_str_append(&buffer,"%" H5_PRINTF_LL_WIDTH "d",
*((long long *) ((void *) (value + i * dst_size))));
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 8e28d82..8c18794 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -1620,7 +1620,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
if(hexdump_g)
p_type = H5Tcopy(type);
else
- p_type = h5tools_get_native_type(type);
+ p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
if(p_type >= 0) {
/* VL data special information */
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index d047612..bc8527b 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -51,19 +51,19 @@ static int have_request(pack_opt_t *options);
*-------------------------------------------------------------------------
*/
int h5repack(const char* infile, const char* outfile, pack_opt_t *options) {
- /* check input */
- if (check_options(options) < 0)
- return -1;
+ /* check input */
+ if (check_options(options) < 0)
+ return -1;
- /* check for objects in input that are in the file */
- if (check_objects(infile, options) < 0)
- return -1;
+ /* check for objects in input that are in the file */
+ if (check_objects(infile, options) < 0)
+ return -1;
- /* copy the objects */
- if (copy_objects(infile, outfile, options) < 0)
- return -1;
+ /* copy the objects */
+ if (copy_objects(infile, outfile, options) < 0)
+ return -1;
- return 0;
+ return 0;
}
/*-------------------------------------------------------------------------
@@ -105,7 +105,7 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest)
*/
int h5repack_end(pack_opt_t *options) {
- return options_table_free(options->op_tbl);
+ return options_table_free(options->op_tbl);
}
/*-------------------------------------------------------------------------
@@ -121,10 +121,10 @@ int h5repack_end(pack_opt_t *options) {
int
h5repack_addfilter(const char* str, pack_opt_t *options)
{
- obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */
- filter_info_t filter; /* filter info for the current -f option entry */
- unsigned n_objs; /* number of objects in the current -f or -l option entry */
- int is_glb; /* is the filter global */
+ obj_list_t *obj_list = NULL; /* one object list for the -f and -l option entry */
+ filter_info_t filter; /* filter info for the current -f option entry */
+ unsigned n_objs; /* number of objects in the current -f or -l option entry */
+ int is_glb; /* is the filter global */
/* parse the -f option */
if (NULL == (obj_list = parse_filter(str, &n_objs, &filter, options, &is_glb)))
@@ -163,10 +163,10 @@ int
h5repack_addlayout(const char* str, pack_opt_t *options)
{
obj_list_t *obj_list = NULL; /*one object list for the -t and -c option entry */
- unsigned n_objs; /*number of objects in the current -t or -c option entry */
- pack_info_t pack; /*info about layout to extract from parse */
- int j;
- int ret_value = -1;
+ unsigned n_objs; /*number of objects in the current -t or -c option entry */
+ pack_info_t pack; /*info about layout to extract from parse */
+ int j;
+ int ret_value = -1;
init_packobject(&pack);
@@ -232,87 +232,84 @@ h5repack_addlayout(const char* str, pack_opt_t *options)
*-------------------------------------------------------------------------
*/
hid_t copy_named_datatype(hid_t type_in, hid_t fidout,
- named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) {
- named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
- named_dt_t *dt_ret = NULL; /* Datatype to return */
- H5O_info_t oinfo; /* Object info of input dtype */
- hid_t ret_value = -1; /* The identifier of the named dtype in the out file */
-
- if (H5Oget_info(type_in, &oinfo) < 0)
- goto done;
-
- if (*named_dt_head_p) {
- /* Stack already exists, search for the datatype */
- while (dt && dt->addr_in != oinfo.addr)
- dt = dt->next;
-
- dt_ret = dt;
- }
- else {
- /* Create the stack */
- size_t i;
-
- for (i = 0; i < travt->nobjs; i++) {
- if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) {
- /* Push onto the stack */
- if (NULL == (dt = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) {
- goto done;
- }
- dt->next = *named_dt_head_p;
- *named_dt_head_p = dt;
-
- /* Update the address and id */
- dt->addr_in = travt->objs[i].objno;
- dt->id_out = -1;
-
- /* Check if this type is the one requested */
- if (oinfo.addr == dt->addr_in) {
- HDassert(!dt_ret);
- dt_ret = dt;
- } /* end if */
- } /* end if */
- } /* end for */
- } /* end else */
-
- /* Handle the case that the requested datatype was not found. This is
- * possible if the datatype was committed anonymously in the input file. */
- if (!dt_ret) {
- /* Push the new datatype onto the stack */
- if (NULL == (dt_ret = (named_dt_t *) HDmalloc(sizeof(named_dt_t)))) {
- goto done;
- }
- dt_ret->next = *named_dt_head_p;
- *named_dt_head_p = dt_ret;
-
- /* Update the address and id */
- dt_ret->addr_in = oinfo.addr;
- dt_ret->id_out = -1;
- } /* end if */
-
- /* If the requested datatype does not yet exist in the output file, copy it
- * anonymously */
- if (dt_ret->id_out < 0) {
- if (options->use_native == 1)
- dt_ret->id_out = h5tools_get_native_type(type_in);
- else
- dt_ret->id_out = H5Tcopy(type_in);
- if (dt_ret->id_out < 0)
- goto done;
- if (H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0)
- goto done;
- } /* end if */
-
- /* Set return value */
- ret_value = dt_ret->id_out;
-
- /* Increment the ref count on id_out, because the calling function will try
- * to close it */
- if(H5Iinc_ref(ret_value) < 0) {
- ret_value = -1;
- }
+ named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) {
+ named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
+ named_dt_t *dt_ret = NULL; /* Datatype to return */
+ H5O_info_t oinfo; /* Object info of input dtype */
+ hid_t ret_value = -1; /* The identifier of the named dtype in the out file */
+
+ if (H5Oget_info(type_in, &oinfo) < 0)
+ goto done;
+
+ if (*named_dt_head_p) {
+ /* Stack already exists, search for the datatype */
+ while (dt && dt->addr_in != oinfo.addr)
+ dt = dt->next;
+
+ dt_ret = dt;
+ }
+ else {
+ /* Create the stack */
+ size_t i;
+
+ for (i = 0; i < travt->nobjs; i++) {
+ if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) {
+ /* Push onto the stack */
+ if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t))))
+ goto done;
+ dt->next = *named_dt_head_p;
+ *named_dt_head_p = dt;
+
+ /* Update the address and id */
+ dt->addr_in = travt->objs[i].objno;
+ dt->id_out = -1;
+
+ /* Check if this type is the one requested */
+ if (oinfo.addr == dt->addr_in) {
+ HDassert(!dt_ret);
+ dt_ret = dt;
+ } /* end if */
+ } /* end if */
+ } /* end for */
+ } /* end else */
+
+ /* Handle the case that the requested datatype was not found. This is
+ * possible if the datatype was committed anonymously in the input file. */
+ if (!dt_ret) {
+ /* Push the new datatype onto the stack */
+ if (NULL == (dt_ret = (named_dt_t *)HDmalloc(sizeof(named_dt_t))))
+ goto done;
+ dt_ret->next = *named_dt_head_p;
+ *named_dt_head_p = dt_ret;
+
+ /* Update the address and id */
+ dt_ret->addr_in = oinfo.addr;
+ dt_ret->id_out = -1;
+ } /* end if */
+
+ /* If the requested datatype does not yet exist in the output file, copy it
+ * anonymously */
+ if (dt_ret->id_out < 0) {
+ if (options->use_native == 1)
+ dt_ret->id_out = H5Tget_native_type(type_in, H5T_DIR_DEFAULT);
+ else
+ dt_ret->id_out = H5Tcopy(type_in);
+ if (dt_ret->id_out < 0)
+ goto done;
+ if (H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ goto done;
+ } /* end if */
+
+ /* Set return value */
+ ret_value = dt_ret->id_out;
+
+ /* Increment the ref count on id_out, because the calling function will try
+ * to close it */
+ if(H5Iinc_ref(ret_value) < 0)
+ ret_value = -1;
done:
- return (ret_value);
+ return (ret_value);
} /* end copy_named_datatype */
/*-------------------------------------------------------------------------
@@ -327,22 +324,22 @@ done:
*-------------------------------------------------------------------------
*/
int named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) {
- named_dt_t *dt = *named_dt_head_p;
- int ret_value = -1;
+ named_dt_t *dt = *named_dt_head_p;
+ int ret_value = -1;
- while (dt) {
- /* Pop the datatype off the stack and free it */
- if (H5Tclose(dt->id_out) < 0 && !ignore_err)
- goto done;
- dt = dt->next;
- HDfree(*named_dt_head_p);
- *named_dt_head_p = dt;
- } /* end while */
+ while (dt) {
+ /* Pop the datatype off the stack and free it */
+ if (H5Tclose(dt->id_out) < 0 && !ignore_err)
+ goto done;
+ dt = dt->next;
+ HDfree(*named_dt_head_p);
+ *named_dt_head_p = dt;
+ } /* end while */
- ret_value = 0;
+ ret_value = 0;
done:
- return (ret_value);
+ return (ret_value);
} /* end named_datatype_free */
/*-------------------------------------------------------------------------
@@ -363,25 +360,25 @@ done:
*/
int
copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
- trav_table_t *travt, pack_opt_t *options)
+ trav_table_t *travt, pack_opt_t *options)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- hid_t attr_id = -1; /* attr ID */
- hid_t attr_out = -1; /* attr ID */
- hid_t space_id = -1; /* space ID */
- hid_t ftype_id = -1; /* file type ID */
- hid_t wtype_id = -1; /* read/write type ID */
- size_t msize; /* size of type */
- void *buf = NULL; /* data buffer */
- hsize_t nelmts; /* number of elements in dataset */
- int rank; /* rank of dataset */
- htri_t is_named; /* Whether the datatype is named */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
- char name[255];
- H5O_info_t oinfo; /* object info */
- int j;
- unsigned u;
- hbool_t is_ref = 0;
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ hid_t attr_id = -1; /* attr ID */
+ hid_t attr_out = -1; /* attr ID */
+ hid_t space_id = -1; /* space ID */
+ hid_t ftype_id = -1; /* file type ID */
+ hid_t wtype_id = -1; /* read/write type ID */
+ size_t msize; /* size of type */
+ void *buf = NULL; /* data buffer */
+ hsize_t nelmts; /* number of elements in dataset */
+ int rank; /* rank of dataset */
+ htri_t is_named; /* Whether the datatype is named */
+ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ char name[255];
+ H5O_info_t oinfo; /* object info */
+ int j;
+ unsigned u;
+ hbool_t is_ref = 0;
H5T_class_t type_class = -1;
if (H5Oget_info(loc_in, &oinfo) < 0)
@@ -425,7 +422,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
} /* end if */
else {
if (options->use_native == 1)
- wtype_id = h5tools_get_native_type(ftype_id);
+ wtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT);
else
wtype_id = H5Tcopy(ftype_id);
} /* end else */
@@ -466,7 +463,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
int nmembers = H5Tget_nmembers(wtype_id);
for (j = 0; j < nmembers; j++) {
- hid_t mtid = H5Tget_member_type(wtype_id, (unsigned) j);
+ hid_t mtid = H5Tget_member_type(wtype_id, (unsigned)j);
H5T_class_t mtclass = H5Tget_class(mtid);
H5Tclose(mtid);
@@ -477,16 +474,13 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p,
} /* for (j=0; i<nmembers; j++) */
} /* if (type_class == H5T_COMPOUND) */
- if (is_ref) {
- ; /* handled by copy_refs_attr() */
- }
- else {
+ if (!is_ref) {
/*-------------------------------------------------------------------------
* read to memory
*-------------------------------------------------------------------------
*/
- buf = (void *) HDmalloc((size_t)(nelmts * msize));
+ buf = (void *)HDmalloc((size_t)(nelmts * msize));
if (buf == NULL) {
error_msg("h5repack", "cannot read into memory\n");
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
@@ -568,193 +562,188 @@ done:
* Programmer: pvn@ncsa.uiuc.edu
*
* Date: September, 22, 2003
- *
- * Modification:
- * Peter Cao, July 9, 2007
- * Add "-L, --latest" and other options to pack a file with the latest file format
- *
*-------------------------------------------------------------------------
*/
static int check_options(pack_opt_t *options) {
- unsigned int i;
- int k, j, has_cp = 0, has_ck = 0;
- char slayout[30];
-
- /*-------------------------------------------------------------------------
- * objects to layout
- *-------------------------------------------------------------------------
- */
- if (options->verbose && have_request(options) /* only print if requested */) {
- printf("Objects to modify layout are...\n");
- if (options->all_layout == 1) {
- switch (options->layout_g) {
- case H5D_COMPACT:
- strcpy(slayout, "compact");
- break;
- case H5D_CONTIGUOUS:
- strcpy(slayout, "contiguous");
- break;
- case H5D_CHUNKED:
- strcpy(slayout, "chunked");
- break;
- case H5D_VIRTUAL:
- strcpy(slayout, "virtual");
- break;
- case H5D_LAYOUT_ERROR:
- case H5D_NLAYOUTS:
- error_msg("invalid layout\n");
- return -1;
- default:
- strcpy(slayout, "invalid layout\n");
- return -1;
- }
- printf(" Apply %s layout to all\n", slayout);
- if (H5D_CHUNKED == options->layout_g) {
- printf("with dimension [");
- for (j = 0; j < options->chunk_g.rank; j++)
- printf("%d ", (int) options->chunk_g.chunk_lengths[j]);
- printf("]\n");
- }
- }
- }/* verbose */
-
- for (i = 0; i < options->op_tbl->nelems; i++) {
- char* name = options->op_tbl->objs[i].path;
-
- if (options->op_tbl->objs[i].chunk.rank > 0) {
- if (options->verbose) {
- printf(" <%s> with chunk size ", name);
- for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++)
- printf("%d ",
- (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]);
- printf("\n");
- }
- has_ck = 1;
- }
- else if (options->op_tbl->objs[i].chunk.rank == -2) {
- if (options->verbose)
- printf(" <%s> %s\n", name, "NONE (contigous)");
- has_ck = 1;
- }
- }
-
- if (options->all_layout == 1 && has_ck) {
- error_msg(
- "invalid chunking input: 'all' option\
+ unsigned int i;
+ int k, j, has_cp = 0, has_ck = 0;
+ char slayout[30];
+
+ /*-------------------------------------------------------------------------
+ * objects to layout
+ *-------------------------------------------------------------------------
+ */
+ if (options->verbose && have_request(options) /* only print if requested */) {
+ printf("Objects to modify layout are...\n");
+ if (options->all_layout == 1) {
+ switch (options->layout_g) {
+ case H5D_COMPACT:
+ strcpy(slayout, "compact");
+ break;
+ case H5D_CONTIGUOUS:
+ strcpy(slayout, "contiguous");
+ break;
+ case H5D_CHUNKED:
+ strcpy(slayout, "chunked");
+ break;
+ case H5D_VIRTUAL:
+ strcpy(slayout, "virtual");
+ break;
+ case H5D_LAYOUT_ERROR:
+ case H5D_NLAYOUTS:
+ error_msg("invalid layout\n");
+ return -1;
+ default:
+ strcpy(slayout, "invalid layout\n");
+ return -1;
+ }
+ printf(" Apply %s layout to all\n", slayout);
+ if (H5D_CHUNKED == options->layout_g) {
+ printf("with dimension [");
+ for (j = 0; j < options->chunk_g.rank; j++)
+ printf("%d ", (int) options->chunk_g.chunk_lengths[j]);
+ printf("]\n");
+ }
+ }
+ }/* verbose */
+
+ for (i = 0; i < options->op_tbl->nelems; i++) {
+ char* name = options->op_tbl->objs[i].path;
+
+ if (options->op_tbl->objs[i].chunk.rank > 0) {
+ if (options->verbose) {
+ printf(" <%s> with chunk size ", name);
+ for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++)
+ printf("%d ",
+ (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]);
+ printf("\n");
+ }
+ has_ck = 1;
+ }
+ else if (options->op_tbl->objs[i].chunk.rank == -2) {
+ if (options->verbose)
+ printf(" <%s> %s\n", name, "NONE (contigous)");
+ has_ck = 1;
+ }
+ }
+
+ if (options->all_layout == 1 && has_ck) {
+ error_msg(
+ "invalid chunking input: 'all' option\
is present with other objects\n");
- return -1;
- }
-
- /*-------------------------------------------------------------------------
- * objects to filter
- *-------------------------------------------------------------------------
- */
-
- if (options->verbose && have_request(options) /* only print if requested */) {
- printf("Objects to apply filter are...\n");
- if (options->all_filter == 1) {
- for (k = 0; k < options->n_filter_g; k++) {
- H5Z_filter_t filtn = options->filter_g[k].filtn;
- switch (filtn) {
- case H5Z_FILTER_NONE:
- printf(" Uncompress all\n");
- break;
- case H5Z_FILTER_SHUFFLE:
- case H5Z_FILTER_FLETCHER32:
- printf(" All with %s\n", get_sfilter(filtn));
- break;
- case H5Z_FILTER_SZIP:
- case H5Z_FILTER_DEFLATE:
- printf(" All with %s, parameter %d\n", get_sfilter(filtn),
- options->filter_g[k].cd_values[0]);
- break;
- default:
- printf(" User Defined %d\n", filtn);
- break;
- } /* k */
- };
- }
- } /* verbose */
-
- for (i = 0; i < options->op_tbl->nelems; i++) {
- pack_info_t pack = options->op_tbl->objs[i];
- char* name = pack.path;
-
- for (j = 0; j < pack.nfilters; j++) {
- if (options->verbose) {
- printf(" <%s> with %s filter\n", name,
- get_sfilter(pack.filter[j].filtn));
- }
-
- has_cp = 1;
-
- } /* j */
- } /* i */
-
- if (options->all_filter == 1 && has_cp) {
- error_msg(
- "invalid compression input: 'all' option\
+ return -1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * objects to filter
+ *-------------------------------------------------------------------------
+ */
+
+ if (options->verbose && have_request(options) /* only print if requested */) {
+ printf("Objects to apply filter are...\n");
+ if (options->all_filter == 1) {
+ for (k = 0; k < options->n_filter_g; k++) {
+ H5Z_filter_t filtn = options->filter_g[k].filtn;
+ switch (filtn) {
+ case H5Z_FILTER_NONE:
+ printf(" Uncompress all\n");
+ break;
+ case H5Z_FILTER_SHUFFLE:
+ case H5Z_FILTER_FLETCHER32:
+ printf(" All with %s\n", get_sfilter(filtn));
+ break;
+ case H5Z_FILTER_SZIP:
+ case H5Z_FILTER_DEFLATE:
+ printf(" All with %s, parameter %d\n", get_sfilter(filtn),
+ options->filter_g[k].cd_values[0]);
+ break;
+ default:
+ printf(" User Defined %d\n", filtn);
+ break;
+ } /* k */
+ };
+ }
+ } /* verbose */
+
+ for (i = 0; i < options->op_tbl->nelems; i++) {
+ pack_info_t pack = options->op_tbl->objs[i];
+ char* name = pack.path;
+
+ for (j = 0; j < pack.nfilters; j++) {
+ if (options->verbose) {
+ printf(" <%s> with %s filter\n", name,
+ get_sfilter(pack.filter[j].filtn));
+ }
+
+ has_cp = 1;
+
+ } /* j */
+ } /* i */
+
+ if (options->all_filter == 1 && has_cp) {
+ error_msg(
+ "invalid compression input: 'all' option\
is present with other objects\n");
- return -1;
- }
-
- /*-------------------------------------------------------------------------
- * check options for the latest format
- *-------------------------------------------------------------------------
- */
-
- if (options->grp_compact < 0) {
- error_msg(
- "invalid maximum number of links to store as header messages\n");
- return -1;
- }
- if (options->grp_indexed < 0) {
- error_msg(
- "invalid minimum number of links to store in the indexed format\n");
- return -1;
- }
- if (options->grp_indexed > options->grp_compact) {
- error_msg(
- "minimum indexed size is greater than the maximum compact size\n");
- return -1;
- }
- for (i = 0; i < 8; i++) {
- if (options->msg_size[i] < 0) {
- error_msg("invalid shared message size\n");
- return -1;
- }
- }
-
- /*--------------------------------------------------------------------------------
- * verify new user userblock options; file name must be present
- *---------------------------------------------------------------------------------
- */
- if (options->ublock_filename != NULL && options->ublock_size == 0) {
- if (options->verbose) {
- printf(
- "Warning: user block size missing for file %s. Assigning a default size of 1024...\n",
- options->ublock_filename);
- options->ublock_size = 1024;
- }
- }
-
- if (options->ublock_filename == NULL && options->ublock_size != 0) {
- error_msg("file name missing for user block\n",
- options->ublock_filename);
- return -1;
- }
-
- /*--------------------------------------------------------------------------------
- * verify alignment options; threshold is zero default but alignment not
- *---------------------------------------------------------------------------------
- */
-
- if (options->alignment == 0 && options->threshold != 0) {
- error_msg("alignment for H5Pset_alignment missing\n");
- return -1;
- }
-
- return 0;
+ return -1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * check options for the latest format
+ *-------------------------------------------------------------------------
+ */
+
+ if (options->grp_compact < 0) {
+ error_msg(
+ "invalid maximum number of links to store as header messages\n");
+ return -1;
+ }
+ if (options->grp_indexed < 0) {
+ error_msg(
+ "invalid minimum number of links to store in the indexed format\n");
+ return -1;
+ }
+ if (options->grp_indexed > options->grp_compact) {
+ error_msg(
+ "minimum indexed size is greater than the maximum compact size\n");
+ return -1;
+ }
+ for (i = 0; i < 8; i++) {
+ if (options->msg_size[i] < 0) {
+ error_msg("invalid shared message size\n");
+ return -1;
+ }
+ }
+
+ /*--------------------------------------------------------------------------------
+ * verify new user userblock options; file name must be present
+ *---------------------------------------------------------------------------------
+ */
+ if (options->ublock_filename != NULL && options->ublock_size == 0) {
+ if (options->verbose) {
+ printf(
+ "Warning: user block size missing for file %s. Assigning a default size of 1024...\n",
+ options->ublock_filename);
+ options->ublock_size = 1024;
+ }
+ }
+
+ if (options->ublock_filename == NULL && options->ublock_size != 0) {
+ error_msg("file name missing for user block\n",
+ options->ublock_filename);
+ return -1;
+ }
+
+ /*--------------------------------------------------------------------------------
+ * verify alignment options; threshold is zero default but alignment not
+ *---------------------------------------------------------------------------------
+ */
+
+ if (options->alignment == 0 && options->threshold != 0) {
+ error_msg("alignment for H5Pset_alignment missing\n");
+ return -1;
+ }
+
+ return 0;
}
/*-------------------------------------------------------------------------
@@ -772,119 +761,121 @@ static int check_options(pack_opt_t *options) {
*-------------------------------------------------------------------------
*/
static int check_objects(const char* fname, pack_opt_t *options) {
- hid_t fid;
- unsigned int i;
- trav_table_t *travt = NULL;
-
- /* nothing to do */
- if (options->op_tbl->nelems == 0)
- return 0;
-
- /*-------------------------------------------------------------------------
- * open the file
- *-------------------------------------------------------------------------
- */
- if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0))
- < 0) {
- printf("<%s>: %s\n", fname, H5FOPENERROR);
- return -1;
- }
-
- /*-------------------------------------------------------------------------
- * get the list of objects in the file
- *-------------------------------------------------------------------------
- */
-
- /* init table */
- trav_table_init(&travt);
-
- /* get the list of objects in the file */
- if (h5trav_gettable(fid, travt) < 0)
- goto out;
-
- /*-------------------------------------------------------------------------
- * compare with user supplied list
- *-------------------------------------------------------------------------
- */
-
- if (options->verbose)
- printf("Opening file <%s>. Searching for objects to modify...\n",
- fname);
-
- for (i = 0; i < options->op_tbl->nelems; i++) {
- char* name = options->op_tbl->objs[i].path;
- if (options->verbose)
- printf(" <%s>", name);
-
- /* the input object names are present in the file and are valid */
- if (h5trav_getindext(name, travt) < 0) {
- error_msg("%s Could not find <%s> in file <%s>. Exiting...\n",
- (options->verbose ? "\n" : ""), name, fname);
- goto out;
- }
- if (options->verbose)
- printf("...Found\n");
-
- /* check for extra filter conditions */
- switch (options->op_tbl->objs[i].filter->filtn) {
- /* chunk size must be smaller than pixels per block */
- case H5Z_FILTER_SZIP:
- {
- int j;
- hsize_t csize = 1;
- unsigned ppb = options->op_tbl->objs[i].filter->cd_values[0];
- hsize_t dims[H5S_MAX_RANK];
- int rank;
- hid_t did;
- hid_t sid;
-
- if (options->op_tbl->objs[i].chunk.rank > 0) {
- rank = options->op_tbl->objs[i].chunk.rank;
- for (j = 0; j < rank; j++)
- csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j];
- }
- else {
- if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
- goto out;
- if ((sid = H5Dget_space(did)) < 0)
- goto out;
- if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
- goto out;
- HDmemset(dims, 0, sizeof dims);
- if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
- goto out;
- for (j = 0; j < rank; j++)
- csize *= dims[j];
- if (H5Sclose(sid) < 0)
- goto out;
- if (H5Dclose(did) < 0)
- goto out;
- }
-
- if (csize < ppb) {
- printf(
- " <warning: SZIP settins, chunk size is smaller than pixels per block>\n");
- goto out;
- }
- }
- break;
- default:
- break;
- }
- } /* i */
-
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- H5Fclose(fid);
- trav_table_free(travt);
- return 0;
+ hid_t fid;
+ unsigned int i;
+ trav_table_t *travt = NULL;
+
+ /* nothing to do */
+ if (options->op_tbl->nelems == 0)
+ return 0;
+
+ /*-------------------------------------------------------------------------
+ * open the file
+ *-------------------------------------------------------------------------
+ */
+ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0))
+ < 0) {
+ printf("<%s>: %s\n", fname, H5FOPENERROR);
+ return -1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * get the list of objects in the file
+ *-------------------------------------------------------------------------
+ */
+
+ /* Initialize indexing options */
+ h5trav_set_index(sort_by, sort_order);
+ /* init table */
+ trav_table_init(&travt);
+
+ /* get the list of objects in the file */
+ if (h5trav_gettable(fid, travt) < 0)
+ goto out;
+
+ /*-------------------------------------------------------------------------
+ * compare with user supplied list
+ *-------------------------------------------------------------------------
+ */
+
+ if (options->verbose)
+ printf("Opening file <%s>. Searching for objects to modify...\n",
+ fname);
+
+ for (i = 0; i < options->op_tbl->nelems; i++) {
+ char* name = options->op_tbl->objs[i].path;
+ if (options->verbose)
+ printf(" <%s>", name);
+
+ /* the input object names are present in the file and are valid */
+ if (h5trav_getindext(name, travt) < 0) {
+ error_msg("%s Could not find <%s> in file <%s>. Exiting...\n",
+ (options->verbose ? "\n" : ""), name, fname);
+ goto out;
+ }
+ if (options->verbose)
+ printf("...Found\n");
+
+ /* check for extra filter conditions */
+ switch (options->op_tbl->objs[i].filter->filtn) {
+ /* chunk size must be smaller than pixels per block */
+ case H5Z_FILTER_SZIP:
+ {
+ int j;
+ hsize_t csize = 1;
+ unsigned ppb = options->op_tbl->objs[i].filter->cd_values[0];
+ hsize_t dims[H5S_MAX_RANK];
+ int rank;
+ hid_t did;
+ hid_t sid;
+
+ if (options->op_tbl->objs[i].chunk.rank > 0) {
+ rank = options->op_tbl->objs[i].chunk.rank;
+ for (j = 0; j < rank; j++)
+ csize *= options->op_tbl->objs[i].chunk.chunk_lengths[j];
+ }
+ else {
+ if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0)
+ goto out;
+ if ((sid = H5Dget_space(did)) < 0)
+ goto out;
+ if ((rank = H5Sget_simple_extent_ndims(sid)) < 0)
+ goto out;
+ HDmemset(dims, 0, sizeof dims);
+ if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
+ goto out;
+ for (j = 0; j < rank; j++)
+ csize *= dims[j];
+ if (H5Sclose(sid) < 0)
+ goto out;
+ if (H5Dclose(did) < 0)
+ goto out;
+ }
+
+ if (csize < ppb) {
+ printf(
+ " <warning: SZIP settins, chunk size is smaller than pixels per block>\n");
+ goto out;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ } /* i */
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ H5Fclose(fid);
+ trav_table_free(travt);
+ return 0;
out:
- H5Fclose(fid);
- trav_table_free(travt);
- return -1;
+ H5Fclose(fid);
+ trav_table_free(travt);
+ return -1;
}
/*-------------------------------------------------------------------------
@@ -900,10 +891,10 @@ out:
*/
static int have_request(pack_opt_t *options) {
- if (options->all_filter || options->all_layout || options->op_tbl->nelems)
- return 1;
+ if (options->all_filter || options->all_layout || options->op_tbl->nelems)
+ return 1;
- return 0;
+ return 0;
}
@@ -918,21 +909,21 @@ static int have_request(pack_opt_t *options) {
*/
static const char* get_sfilter(H5Z_filter_t filtn) {
- if (filtn == H5Z_FILTER_NONE)
- return "NONE";
- else if (filtn == H5Z_FILTER_DEFLATE)
- return "GZIP";
- else if (filtn == H5Z_FILTER_SZIP)
- return "SZIP";
- else if (filtn == H5Z_FILTER_SHUFFLE)
- return "SHUFFLE";
- else if (filtn == H5Z_FILTER_FLETCHER32)
- return "FLETCHER32";
- else if (filtn == H5Z_FILTER_NBIT)
- return "NBIT";
- else if (filtn == H5Z_FILTER_SCALEOFFSET)
- return "SOFF";
- else
- return "UD";
+ if (filtn == H5Z_FILTER_NONE)
+ return "NONE";
+ else if (filtn == H5Z_FILTER_DEFLATE)
+ return "GZIP";
+ else if (filtn == H5Z_FILTER_SZIP)
+ return "SZIP";
+ else if (filtn == H5Z_FILTER_SHUFFLE)
+ return "SHUFFLE";
+ else if (filtn == H5Z_FILTER_FLETCHER32)
+ return "FLETCHER32";
+ else if (filtn == H5Z_FILTER_NBIT)
+ return "NBIT";
+ else if (filtn == H5Z_FILTER_SCALEOFFSET)
+ return "SOFF";
+ else
+ return "UD";
}
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index e36f0ef..e5ae03f 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -29,10 +29,10 @@
#define MAX_COMPACT_DSIZE 64512 /* max data size for compact layout. -1k for header size */
/* File space default information */
-#define FS_PAGESIZE_DEF 4096
-#define FS_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
-#define FS_PERSIST_DEF FALSE
-#define FS_THRESHOLD_DEF 1
+#define FS_PAGESIZE_DEF 4096
+#define FS_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
+#define FS_PERSIST_DEF FALSE
+#define FS_THRESHOLD_DEF 1
/*-------------------------------------------------------------------------
@@ -120,10 +120,10 @@ typedef struct {
hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
hsize_t threshold; /* alignment threshold for H5Pset_alignment */
hsize_t alignment; /* alignment for H5Pset_alignment */
- H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
- int fs_persist; /* Free space section threshold */
- long fs_threshold; /* Free space section threshold */
- long long fs_pagesize; /* File space page size */
+ H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */
+ int fs_persist; /* Free space section threshold */
+ long fs_threshold; /* Free space section threshold */
+ long long fs_pagesize; /* File space page size */
} pack_opt_t;
@@ -150,10 +150,10 @@ int h5repack_end(pack_opt_t *options);
int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options);
int h5repack_cmp_pl(const char *fname1, const char *fname2);
-/* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr()
- * and struct named_dt_t were located in h5repack_copy.c as static prior to
- * bugfix1726.
- * Made shared functions as copy_attr() was needed in h5repack_refs.c.
+/* Note: The below copy_named_datatype(), named_datatype_free(), copy_attr()
+ * and struct named_dt_t were located in h5repack_copy.c as static prior to
+ * bugfix1726.
+ * Made shared functions as copy_attr() was needed in h5repack_refs.c.
* However copy_attr() may be obsoleted when H5Acopy is available and put back
* others to static in h5repack_copy.c.
*/
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index e7c3bfe..946f5ad 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -31,7 +31,7 @@
*/
/* size of buffer/# of bytes to xfer at a time when copying userblock */
-#define USERBLOCK_XFER_SIZE 512
+#define USERBLOCK_XFER_SIZE 512
/* check H5Dread()/H5Dwrite() error, e.g. memory allocation error inside the library. */
#define CHECK_H5DRW_ERROR(_fun, _fail, _did, _mtid, _msid, _fsid, _pid, _buf) { \
@@ -52,12 +52,12 @@
*-------------------------------------------------------------------------
*/
static int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
- size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p);
+ size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p);
static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr);
static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
- pack_opt_t *options);
+ pack_opt_t *options);
static int copy_user_block(const char *infile, const char *outfile,
- hsize_t size);
+ hsize_t size);
#if defined (H5REPACK_DEBUG_USER_BLOCK)
static void print_user_block(const char *filename, hid_t fid);
#endif
@@ -65,18 +65,19 @@ static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void
/* get the major number from the error stack. */
static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) {
- if (err_desc)
- *((hid_t *) udata) = err_desc->maj_num;
+ if (err_desc)
+ *((hid_t *) udata) = err_desc->maj_num;
- return 0;
+ return 0;
}
/*-------------------------------------------------------------------------
* Function: copy_objects
*
- * Purpose: duplicate all HDF5 objects in the file
+ * Purpose: duplicate all HDF5 objects in the file
*
- * Return: 0, ok, -1 no
+ * Return: 0, ok,
+ * -1 no
*
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
@@ -87,21 +88,22 @@ static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t
int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 0; /* no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
hid_t fidin;
hid_t fidout = -1;
trav_table_t *travt = NULL;
- hsize_t ub_size = 0; /* size of user block */
- hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
- hid_t fapl = H5P_DEFAULT; /* file access property list ID */
- H5F_fspace_strategy_t set_strategy; /* Strategy to be set in outupt file */
- hbool_t set_persist; /* Persist free-space status to be set in output file */
- hsize_t set_threshold; /* Free-space section threshold to be set in output file */
- hsize_t set_pagesize; /* File space page size to be set in output file */
- H5F_fspace_strategy_t in_strategy; /* Strategy from input file */
- hbool_t in_persist; /* Persist free-space status from input file */
- hsize_t in_threshold; /* Free-space section threshold from input file */
- hsize_t in_pagesize; /* File space page size from input file */
+ hsize_t ub_size = 0; /* size of user block */
+ hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
+ hid_t fapl = H5P_DEFAULT; /* file access property list ID */
+ H5F_fspace_strategy_t set_strategy; /* Strategy to be set in outupt file */
+ hbool_t set_persist; /* Persist free-space status to be set in output file */
+ hsize_t set_threshold; /* Free-space section threshold to be set in output file */
+ hsize_t set_pagesize; /* File space page size to be set in output file */
+ H5F_fspace_strategy_t in_strategy; /* Strategy from input file */
+ hbool_t in_persist; /* Persist free-space status from input file */
+ hsize_t in_threshold; /* Free-space section threshold from input file */
+ hsize_t in_pagesize; /* File space page size from input file */
+ unsigned crt_order_flags; /* group creation order flag */
/*-------------------------------------------------------------------------
* open input file
@@ -115,6 +117,8 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
/* get user block size and file space strategy/persist/threshold */
{
hid_t fcpl_in; /* file creation property list ID for input file */
+ hid_t grp_in = -1; /* group ID */
+ hid_t gcpl_in = -1; /* group creation property list */
if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
error_msg("failed to retrieve file creation property list\n");
@@ -126,17 +130,28 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- /* If the -S option is not set, get "strategy" from the input file */
- if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) {
- error_msg("failed to retrieve file space strategy\n");
+ /* If the -S option is not set, get "strategy" from the input file */
+ if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) {
+ error_msg("failed to retrieve file space strategy\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+
+ /* If the -G option is not set, get "pagesize" from the input file */
+ if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) {
+ error_msg("failed to retrieve file space threshold\n");
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
+ /* open root group */
+ if ((grp_in = H5Gopen2(fidin, "/", H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
- /* If the -G option is not set, get "pagesize" from the input file */
- if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) {
- error_msg("failed to retrieve file space threshold\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
- }
+ /* get root group creation property list */
+ if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed");
+
+ /* query and set the group creation properties */
+ if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
if (H5Pclose(fcpl_in) < 0) {
error_msg("failed to close property list\n");
@@ -295,9 +310,9 @@ print_user_block(fnamein, fidin);
}
/*-------------------------------------------------------------------------
- * Set file space information
- *-------------------------------------------------------------------------
- */
+ * Set file space information
+ *-------------------------------------------------------------------------
+ */
/* either use the FCPL already created or create a new one */
if (fcpl == H5P_DEFAULT) {
@@ -308,6 +323,9 @@ print_user_block(fnamein, fidin);
}
}
+ if(H5Pset_link_creation_order(fcpl, crt_order_flags ) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_creation_order failed");
+
/* Set file space info to those from input file */
set_strategy = in_strategy;
set_persist = in_persist;
@@ -323,7 +341,7 @@ print_user_block(fnamein, fidin);
set_persist = FS_PERSIST_DEF;
else if(options->fs_persist != 0) /* Set "persist" as specified by user */
set_persist = (hbool_t)options->fs_persist;
-
+
if(options->fs_threshold == -1) /* A "0" threshold is specified by user */
set_threshold = (hsize_t)0;
else if(options->fs_threshold != 0) /* Set threshold as specified by user */
@@ -331,7 +349,7 @@ print_user_block(fnamein, fidin);
/* Set file space information as specified */
if(H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0) {
- error_msg("failed to set file space strategy\n");
+ error_msg("failed to set file space strategy\n");
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
@@ -343,7 +361,7 @@ print_user_block(fnamein, fidin);
if(set_pagesize != FS_PAGESIZE_DEF) /* Set non-default file space page size as specified */
if(H5Pset_file_space_page_size(fcpl, set_pagesize) < 0) {
error_msg("failed to set file space page size\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
/*-------------------------------------------------------------------------
@@ -374,6 +392,8 @@ print_user_block(fnamein, fidin);
*-------------------------------------------------------------------------
*/
+ /* Initialize indexing options */
+ h5trav_set_index(sort_by, sort_order);
/* init table */
trav_table_init(&travt);
@@ -490,10 +510,10 @@ done:
int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- int k;
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int k;
H5D_layout_t dset_layout;
- int rank_chunk;
+ int rank_chunk;
hsize_t dims_chunk[H5S_MAX_RANK];
hsize_t size_chunk = 1;
hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
@@ -705,36 +725,36 @@ done:
*/
int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
- pack_opt_t *options) /* repack options */
+ pack_opt_t *options) /* repack options */
{
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- hid_t grp_in = -1; /* group ID */
- hid_t grp_out = -1; /* group ID */
- hid_t dset_in = -1; /* read dataset ID */
+ hid_t grp_in = -1; /* group ID */
+ hid_t grp_out = -1; /* group ID */
+ hid_t dset_in = -1; /* read dataset ID */
hid_t dset_out = -1; /* write dataset ID */
- hid_t gcpl_in = -1; /* group creation property list */
+ hid_t gcpl_in = -1; /* group creation property list */
hid_t gcpl_out = -1; /* group creation property list */
- hid_t type_in = -1; /* named type ID */
+ hid_t type_in = -1; /* named type ID */
hid_t type_out = -1; /* named type ID */
- hid_t dcpl_in = -1; /* dataset creation property list ID */
+ hid_t dcpl_in = -1; /* dataset creation property list ID */
hid_t dcpl_out = -1; /* dataset creation property list ID */
hid_t f_space_id = -1; /* file space ID */
hid_t ftype_id = -1; /* file type ID */
hid_t wtype_id = -1; /* read/write type ID */
named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
- size_t msize; /* size of type */
- hsize_t nelmts; /* number of elements in dataset */
+ size_t msize; /* size of type */
+ hsize_t nelmts; /* number of elements in dataset */
H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */
- int rank; /* rank of dataset */
+ int rank; /* rank of dataset */
hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
- hsize_t dsize_in; /* input dataset size before filter */
- hsize_t dsize_out; /* output dataset size after filter */
- int apply_s; /* flag for apply filter to small dataset sizes */
- int apply_f; /* flag for apply filter to return error on H5Dcreate */
- void *buf = NULL; /* buffer for raw data */
+ hsize_t dsize_in; /* input dataset size before filter */
+ hsize_t dsize_out; /* output dataset size after filter */
+ int apply_s; /* flag for apply filter to small dataset sizes */
+ int apply_f; /* flag for apply filter to return error on H5Dcreate */
+ void *buf = NULL; /* buffer for raw data */
void *hslab_buf = NULL; /* hyperslab buffer for raw data */
- int has_filter; /* current object has a filter */
- int req_filter; /* there was a request for a filter */
+ int has_filter; /* current object has a filter */
+ int req_filter; /* there was a request for a filter */
int req_obj_layout = 0; /* request layout to current object */
unsigned crt_order_flags; /* group creation order flag */
unsigned i;
@@ -915,7 +935,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
/* wtype_id will have already been set if using a named dtype */
if (!is_named) {
if (options->use_native == 1)
- wtype_id = h5tools_get_native_type(ftype_id);
+ wtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT);
else
wtype_id = H5Tcopy(ftype_id);
} /* end if */
@@ -1349,20 +1369,19 @@ done:
*
*-------------------------------------------------------------------------
*/
-static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio,
- int pr)
+static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
{
- char strfilter[255];
+ char strfilter[255];
#if defined (PRINT_DEBUG )
- char temp[255];
+ char temp[255];
#endif
- int nfilters; /* number of filters */
- unsigned filt_flags; /* filter flags */
- H5Z_filter_t filtn; /* filter identification number */
- unsigned cd_values[20]; /* filter client data values */
- size_t cd_nelmts; /* filter client number of values */
- char f_objname[256]; /* filter objname */
- int i;
+ int nfilters; /* number of filters */
+ unsigned filt_flags; /* filter flags */
+ H5Z_filter_t filtn; /* filter identification number */
+ unsigned cd_values[20]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+ char f_objname[256]; /* filter objname */
+ int i;
HDstrcpy(strfilter, "\0");
@@ -1461,10 +1480,9 @@ static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio,
*
*-------------------------------------------------------------------------
*/
-static int copy_user_block(const char *infile, const char *outfile,
- hsize_t size)
+static int copy_user_block(const char *infile, const char *outfile, hsize_t size)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
int infid = -1, outfid = -1; /* File descriptors */
/* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */
@@ -1541,67 +1559,68 @@ done:
static
void print_user_block(const char *filename, hid_t fid)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- int fh; /* file handle */
- hsize_t ub_size; /* user block size */
- hsize_t size; /* size read */
- hid_t fcpl; /* file creation property list ID for HDF5 file */
- int i;
-
- /* get user block size */
- if(( fcpl = H5Fget_create_plist(fid)) < 0) {
- error_msg("failed to retrieve file creation property list\n");
+ int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
+ int fh; /* file handle */
+ hsize_t ub_size; /* user block size */
+ hsize_t size; /* size read */
+ hid_t fcpl; /* file creation property list ID for HDF5 file */
+ int i;
+
+ /* get user block size */
+ if(( fcpl = H5Fget_create_plist(fid)) < 0) {
+ error_msg("failed to retrieve file creation property list\n");
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed");
}
- if(H5Pget_userblock(fcpl, &ub_size) < 0) {
- error_msg("failed to retrieve userblock size\n");
+ if(H5Pget_userblock(fcpl, &ub_size) < 0) {
+ error_msg("failed to retrieve userblock size\n");
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_userblock failed");
}
- if(H5Pclose(fcpl) < 0) {
- error_msg("failed to close property list\n");
+ if(H5Pclose(fcpl) < 0) {
+ error_msg("failed to close property list\n");
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
}
- /* open file */
- if((fh = HDopen(filename, O_RDONLY)) < 0) {
+ /* open file */
+ if((fh = HDopen(filename, O_RDONLY)) < 0) {
+ error_msg("failed to open file\n");
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed");
}
- size = ub_size;
+ size = ub_size;
- /* read file */
- while(size > 0) {
- ssize_t nread; /* # of bytes read */
- char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */
+ /* read file */
+ while(size > 0) {
+ ssize_t nread; /* # of bytes read */
+ char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */
- /* read buffer */
- if(size > USERBLOCK_XFER_SIZE)
- nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE);
- else
- nread = HDread(fh, rbuf, (size_t)size);
+ /* read buffer */
+ if(size > USERBLOCK_XFER_SIZE)
+ nread = HDread(fh, rbuf, (size_t)USERBLOCK_XFER_SIZE);
+ else
+ nread = HDread(fh, rbuf, (size_t)size);
- for(i = 0; i < nread; i++) {
+ for(i = 0; i < nread; i++) {
- printf("%c ", rbuf[i]);
+ printf("%c ", rbuf[i]);
- }
- printf("\n");
+ }
+ printf("\n");
- if(nread < 0) {
+ if(nread < 0) {
HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "nread < 0");
}
- /* update size of userblock left to transfer */
- size -= nread;
- }
+ /* update size of userblock left to transfer */
+ size -= nread;
+ }
done:
- if(fh > 0)
- HDclose(fh);
+ if(fh > 0)
+ HDclose(fh);
- return;
+ return;
}
#endif
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 339dc83..31b1e14 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -31,7 +31,7 @@ const char *outfile = NULL;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:P:T:G:E";
+static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:P:T:G:q:z:E";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "version", no_arg, 'V' },
@@ -56,6 +56,8 @@ static struct long_options l_opts[] = {
{ "fs_persist", require_arg, 'P' },
{ "fs_threshold", require_arg, 'T' },
{ "fs_pagesize", require_arg, 'G' },
+ { "sort_by", require_arg, 'q' },
+ { "sort_order", require_arg, 'z' },
{ "enable-error-stack", no_arg, 'E' },
{ NULL, 0, '\0' }
};
@@ -90,6 +92,8 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " -M A, --metadata_block_size=A Metadata block size for H5Pset_meta_block_size\n");
PRINTVALSTREAM(rawoutstream, " -t T, --threshold=T Threshold value for H5Pset_alignment\n");
PRINTVALSTREAM(rawoutstream, " -a A, --alignment=A Alignment value for H5Pset_alignment\n");
+ PRINTVALSTREAM(rawoutstream, " -q Q, --sort_by=Q Sort groups and attributes by index Q\n");
+ PRINTVALSTREAM(rawoutstream, " -z Z, --sort_order=Z Sort groups and attributes by order Z\n");
PRINTVALSTREAM(rawoutstream, " -f FILT, --filter=FILT Filter type\n");
PRINTVALSTREAM(rawoutstream, " -l LAYT, --layout=LAYT Layout type\n");
PRINTVALSTREAM(rawoutstream, " -S FS_STRATEGY, --fs_strategy=FS_STRATEGY File space management strategy for H5Pset_file_space_strategy\n");
@@ -103,6 +107,8 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " U - is a filename.\n");
PRINTVALSTREAM(rawoutstream, " T - is an integer\n");
PRINTVALSTREAM(rawoutstream, " A - is an integer greater than zero\n");
+ PRINTVALSTREAM(rawoutstream, " Q - is the sort index type for the input file. It can be \"name\" or \"creation_order\" (default)\n");
+ PRINTVALSTREAM(rawoutstream, " Z - is the sort order type for the input file. It can be \"descending\" or \"ascending\" (default)\n");
PRINTVALSTREAM(rawoutstream, " B - is the user block size, any value that is 512 or greater and is\n");
PRINTVALSTREAM(rawoutstream, " a power of 2 (1024 default)\n");
PRINTVALSTREAM(rawoutstream, " F - is the shared object header message type, any of <dspace|dtype|fill|\n");
@@ -370,6 +376,52 @@ done:
}
/*-------------------------------------------------------------------------
+ * Function: set_sort_by
+ *
+ * Purpose: set the "by" form of sorting by translating from a string input
+ * parameter to a H5_index_t return value
+ * current sort values are [creation_order | name]
+ *
+ * Return: H5_index_t form of sort or H5_INDEX_UNKNOWN if none found
+ *-------------------------------------------------------------------------
+ */
+static H5_index_t
+set_sort_by(const char *form)
+{
+ H5_index_t idx_type = H5_INDEX_UNKNOWN;
+
+ if (HDstrcmp(form,"name")==0) /* H5_INDEX_NAME */
+ idx_type = H5_INDEX_NAME;
+ else if (HDstrcmp(form,"creation_order")==0) /* H5_INDEX_CRT_ORDER */
+ idx_type = H5_INDEX_CRT_ORDER;
+
+ return idx_type;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: set_sort_order
+ *
+ * Purpose: set the order of sorting by translating from a string input
+ * parameter to a H5_iter_order_t return value
+ * current order values are [ascending | descending ]
+ *
+ * Return: H5_iter_order_t form of order or H5_ITER_UNKNOWN if none found
+ *-------------------------------------------------------------------------
+ */
+static H5_iter_order_t
+set_sort_order(const char *form)
+{
+ H5_iter_order_t iter_order = H5_ITER_UNKNOWN;
+
+ if (HDstrcmp(form,"ascending")==0) /* H5_ITER_INC */
+ iter_order = H5_ITER_INC;
+ else if (HDstrcmp(form,"descending")==0) /* H5_ITER_DEC */
+ iter_order = H5_ITER_DEC;
+
+ return iter_order;
+}
+
+/*-------------------------------------------------------------------------
* Function: parse_command_line
*
* Purpose: parse command line input
@@ -553,14 +605,14 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'P':
- options->fs_persist = HDatoi( opt_arg );
+ options->fs_persist = HDatoi(opt_arg);
if(options->fs_persist == 0)
/* To distinguish the "specified" zero value */
options->fs_persist = -1;
break;
case 'T':
- options->fs_threshold = HDatol( opt_arg );
+ options->fs_threshold = HDatol(opt_arg);
if(options->fs_threshold == 0)
/* To distinguish the "specified" zero value */
options->fs_threshold = -1;
@@ -570,12 +622,30 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
options->fs_pagesize = HDstrtoll(opt_arg, NULL, 0);
if(options->fs_pagesize == 0)
/* To distinguish the "specified" zero value */
- options->fs_pagesize = -1;
+ options->fs_pagesize = -1;
break;
- case 'E':
- enable_error_stack = TRUE;
- break;
+ case 'q':
+ if((sort_by = set_sort_by(opt_arg)) < 0) {
+ error_msg(" failed to set sort by form <%s>\n", opt_arg);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ break;
+
+ case 'z':
+ if((sort_order = set_sort_order(opt_arg)) < 0) {
+ error_msg(" failed to set sort order form <%s>\n", opt_arg);
+ h5tools_setstatus(EXIT_FAILURE);
+ ret_value = -1;
+ goto done;
+ }
+ break;
+
+ case 'E':
+ enable_error_stack = TRUE;
+ break;
default:
break;
@@ -644,6 +714,9 @@ int main(int argc, const char **argv)
/* initialize options */
h5repack_init(&options, 0, FALSE);
+ /* Initialize default indexing options */
+ sort_by = H5_INDEX_CRT_ORDER;
+
if (parse_command_line(argc, argv, &options) < 0)
goto done;
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index 2c38d94..408142c 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -25,7 +25,7 @@ static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt);
static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options,
trav_table_t *travt, hid_t fidout);
static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
- hid_t fid_out, void *ref_out, trav_table_t *travt);
+ hid_t fid_out, void *ref_out, trav_table_t *travt);
/*-------------------------------------------------------------------------
* Function: do_copy_refobjs
@@ -126,8 +126,8 @@ int do_copy_refobjs(hid_t fidin,
for(k = 0; k < rank; k++)
nelmts *= dims[k];
- if((mtype_id = h5tools_get_native_type(ftype_id)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_get_native_type failed");
+ if((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed");
if((msize = H5Tget_size(mtype_id)) == 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
@@ -425,13 +425,13 @@ done:
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
*
* Modifier: xcao@hdfgroup.org, 9/12/2011
- * Update values of references(object and region) for the following types:
+ * Update values of references(object and region) for the following types:
* 1) References,
* 2) ARRAY of reference,
* 3) VLEN of references.
* 4) COMPOUND of references.
* This function does not handle references in other complicated structures,
- * such as references in nested compound datatypes.
+ * such as references in nested compound datatypes.
*
* Date: October, 28, 2003
*
@@ -472,7 +472,7 @@ static int copy_refs_attr(hid_t loc_in,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed");
for(u = 0; u < (unsigned)oinfo.num_attrs; u++) {
- is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0;
+ is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0;
/* open attribute */
if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -484,8 +484,8 @@ static int copy_refs_attr(hid_t loc_in,
type_class = H5Tget_class(ftype_id);
- if((mtype_id = h5tools_get_native_type(ftype_id)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_get_native_type failed");
+ if((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed");
if((msize = H5Tget_size(mtype_id)) == 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
@@ -528,9 +528,9 @@ static int copy_refs_attr(hid_t loc_in,
}
H5Tclose(mtid);
}
-
- /* if compound don't contain reference type member, free the above
- * mallocs. Otherwise there can be memory leaks by the 'continue'
+
+ /* if compound don't contain reference type member, free the above
+ * mallocs. Otherwise there can be memory leaks by the 'continue'
* statement below. */
if (!ref_comp_field_n) {
if (ref_comp_index) {
@@ -539,7 +539,7 @@ static int copy_refs_attr(hid_t loc_in,
}
if (ref_comp_size) {
- HDfree(ref_comp_size);
+ HDfree(ref_comp_size);
ref_comp_size = NULL;
}
}
@@ -588,7 +588,7 @@ static int copy_refs_attr(hid_t loc_in,
array_rank = (unsigned)H5Tget_array_ndims(mtype_id);
H5Tget_array_dims2(mtype_id, array_dims);
for(j = 0; j <array_rank; j++)
- array_size *= array_dims[j];
+ array_size *= array_dims[j];
nelmts *= array_size;
}
@@ -648,7 +648,7 @@ static int copy_refs_attr(hid_t loc_in,
}
} /* H5T_STD_REF_DSETREG */
else if (is_ref_vlen) {
- /* handle VLEN of references */
+ /* handle VLEN of references */
buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t)));
refbuf = buf; /* reuse the read buffer for write */
@@ -688,7 +688,7 @@ static int copy_refs_attr(hid_t loc_in,
}
} /* else if (is_ref_vlen) */
else if (is_ref_comp) {
- /* handle ref fields in a compound */
+ /* handle ref fields in a compound */
buf = HDmalloc((unsigned)(nelmts * msize));
refbuf = buf; /* reuse the read buffer for write */
@@ -728,7 +728,7 @@ static int copy_refs_attr(hid_t loc_in,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed");
if (is_ref_vlen && buf)
- H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf);
+ H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf);
} /* if (nelmts) */
if (refbuf == buf)
@@ -780,10 +780,10 @@ done:
HDfree(buf);
if (ref_comp_index)
- HDfree(ref_comp_index);
+ HDfree(ref_comp_index);
if (ref_comp_size)
- HDfree(ref_comp_size);
+ HDfree(ref_comp_size);
H5E_BEGIN_TRY {
H5Tclose(ftype_id);
@@ -797,9 +797,9 @@ done:
}
/*-------------------------------------------------------------------------
- * Function: MapIdToName
+ * Function: MapIdToName
*
- * Purpose: map a ID from a reference to a dataset name
+ * Purpose: map a ID from a reference to a dataset name
*
*-------------------------------------------------------------------------
*/
@@ -832,16 +832,16 @@ out:
}
/*-------------------------------------------------------------------------
- * Function: Update_Ref_value
+ * Function: Update_Ref_value
*
- * Purpose: Update a reference value
+ * Purpose: Update a reference value
*
* Programmer: xcao@hdfgroup.org 9/12/2011
*
*-------------------------------------------------------------------------
*/
static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
- hid_t fid_out, void *ref_out, trav_table_t *travt)
+ hid_t fid_out, void *ref_out, trav_table_t *travt)
{
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
const char* ref_obj_name;
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index 7e79aa7..1a0dab7 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -55,11 +55,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
trav_table_t *travt = NULL;
int ok = 1;
hid_t fcpl_in = -1; /* file creation property for input file */
- hid_t fcpl_out = -1; /* file creation property for output file */
- H5F_fspace_strategy_t in_strategy, out_strategy; /* file space handling strategy for in/output file */
- hbool_t in_persist, out_persist; /* free-space persist status for in/output file */
- hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */
- hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */
+ hid_t fcpl_out = -1; /* file creation property for output file */
+ H5F_fspace_strategy_t in_strategy, out_strategy; /* file space handling strategy for in/output file */
+ hbool_t in_persist, out_persist; /* free-space persist status for in/output file */
+ hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */
+ hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */
/* open the output file */
if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
@@ -122,6 +122,8 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
if(options->all_filter == 1 || options->all_layout == 1)
{
+ /* Initialize indexing options */
+ h5trav_set_index(sort_by, sort_order);
/* init table */
trav_table_init(&travt);
@@ -247,7 +249,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* the same as the input file's strategy.
*/
if(options->fs_strategy) {
- if(out_strategy != (options->fs_strategy == (-1) ? 0 : options->fs_strategy)) {
+ if(out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy)) {
error_msg("file space strategy not set as unexpected\n");
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
}
@@ -455,6 +457,9 @@ int h5repack_cmp_pl(const char *fname1,
* get file table list of objects
*-------------------------------------------------------------------------
*/
+ /* Initialize indexing options */
+ h5trav_set_index(sort_by, sort_order);
+ /* init table */
trav_table_init(&trav);
if(h5trav_gettable(fid1, trav) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
@@ -643,7 +648,7 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
{
case H5Z_FILTER_NONE:
- break;
+ break;
case H5Z_FILTER_SHUFFLE:
/* 1 private client value is returned by DCPL */