summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/h5dump/h5dump.c104
-rw-r--r--tools/h5dump/h5dump.h19
-rw-r--r--tools/h5dump/h5dump_ddl.c345
-rw-r--r--tools/h5repack/h5repack_copy.c106
-rw-r--r--tools/h5repack/h5repack_verify.c4
-rw-r--r--tools/lib/h5diff_util.c131
-rw-r--r--tools/lib/h5tools.c85
-rw-r--r--tools/lib/h5tools.h39
-rw-r--r--tools/lib/h5tools_dump.c149
-rw-r--r--tools/lib/h5tools_error.h2
-rw-r--r--tools/lib/h5tools_filters.c76
-rw-r--r--tools/lib/h5tools_ref.c8
-rw-r--r--tools/lib/h5tools_str.c333
-rw-r--r--tools/lib/h5tools_str.h5
-rw-r--r--tools/lib/h5tools_type.c193
-rw-r--r--tools/lib/h5tools_utils.c22
-rw-r--r--tools/lib/h5tools_utils.h6
17 files changed, 860 insertions, 767 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 5b953cb..9efb6db 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -620,10 +620,9 @@ parse_hsize_list(const char *h_list, subset_d *d)
size_count++;
last_digit = 1;
- }
- else {
- last_digit = 0;
}
+ else
+ last_digit = 0;
if (size_count == 0)
/* there aren't any integers to read */
@@ -635,7 +634,7 @@ parse_hsize_list(const char *h_list, subset_d *d)
for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
if(HDisdigit(*ptr)) {
/* we should have an integer now */
- p_list[i++] = (hsize_t)HDatof(ptr);
+ p_list[i++] = (hsize_t)HDstrtoull(ptr, NULL, 0);
while (HDisdigit(*ptr))
/* scroll to end of integer */
@@ -643,8 +642,6 @@ parse_hsize_list(const char *h_list, subset_d *d)
}
d->data = p_list;
d->len = size_count;
-
- return;
}
/*-------------------------------------------------------------------------
@@ -667,7 +664,7 @@ static struct subset_t *
parse_subset_params(char *dset)
{
struct subset_t *s = NULL;
- register char *brace;
+ char *brace;
if (!disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) {
*brace++ = '\0';
@@ -705,20 +702,21 @@ parse_subset_params(char *dset)
*
* Purpose: Parse a list of comma or space separated integers and fill
* the packed_bits list and counter. The string being passed into this function
- * should be at the start of the list you want to parse.
+ * should be at the start of the list you want to parse.
*
* Return: Success: SUCCEED
*
* Failure: FAIL
*
- *
*-------------------------------------------------------------------------
*/
static int
parse_mask_list(const char *h_list)
{
- int offset_value;
- int length_value;
+ int soffset_value;
+ unsigned offset_value;
+ int slength_value;
+ unsigned length_value;
unsigned long long temp_mask;
const char *ptr = NULL;
@@ -736,10 +734,11 @@ parse_mask_list(const char *h_list)
error_msg("Bad mask list(%s)\n", h_list);
return FAIL;
}
- offset_value = HDatoi(ptr);
- if (offset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) {
- error_msg("Packed Bit offset value(%d) must be between 0 and %d\n",
- offset_value, PACKED_BITS_SIZE_MAX - 1);
+ soffset_value = HDatoi(ptr);
+ offset_value = (unsigned)soffset_value;
+ if (soffset_value < 0 || offset_value >= PACKED_BITS_SIZE_MAX) {
+ error_msg("Packed Bit offset value(%d) must be between 0 and %u\n",
+ soffset_value, (unsigned)(PACKED_BITS_SIZE_MAX - 1));
return FAIL;
}
@@ -757,14 +756,15 @@ parse_mask_list(const char *h_list)
error_msg("Bad mask list(%s)\n", h_list);
return FAIL;
}
- length_value = HDatoi(ptr);
- if (length_value <= 0) {
- error_msg("Packed Bit length value(%d) must be positive.\n", length_value);
+ slength_value = HDatoi(ptr);
+ if (slength_value <= 0) {
+ error_msg("Packed Bit length value(%d) must be positive.\n", slength_value);
return FAIL;
}
- if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX){
- error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n",
- offset_value+length_value, PACKED_BITS_SIZE_MAX);
+ length_value = (unsigned)slength_value;
+ if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX) {
+ error_msg("Packed Bit offset+length value(%u) too large. Max is %u\n",
+ offset_value+length_value, (unsigned)PACKED_BITS_SIZE_MAX);
return FAIL;
}
@@ -783,8 +783,8 @@ parse_mask_list(const char *h_list)
/* create the bit mask by left shift 1's by length, then negate it. */
/* After packed_mask is calculated, packed_length is not needed but */
/* keep it for debug purpose. */
- temp_mask = ~0L;
- if(length_value<8*sizeof(unsigned long long)) {
+ temp_mask = ~0ULL;
+ if(length_value < (int)(8 *sizeof(unsigned long long))) {
temp_mask = temp_mask << length_value;
packed_mask[packed_bits_num] = ~temp_mask;
}
@@ -831,7 +831,7 @@ static void
free_handler(struct handler_t *hand, int len)
{
int i;
-
+
if(hand) {
for (i = 0; i < len; i++) {
if(hand[i].obj) {
@@ -956,11 +956,15 @@ parse_start:
goto done;
break;
case 'w':
- h5tools_nCols = HDatoi(opt_arg);
- if (h5tools_nCols <= 0) {
- h5tools_nCols = 65535;
+ {
+ int sh5tools_nCols = HDatoi(opt_arg);
+
+ if (sh5tools_nCols <= 0)
+ h5tools_nCols = 65535;
+ else
+ h5tools_nCols = (unsigned)sh5tools_nCols;
+ last_was_dset = FALSE;
}
- last_was_dset = FALSE;
break;
case 'N':
display_all = 0;
@@ -1159,12 +1163,10 @@ parse_start:
usage(h5tools_getprogname());
goto error;
}
- if (HDstrcmp(opt_arg,":") == 0) {
+ if (HDstrcmp(opt_arg,":") == 0)
xmlnsprefix = "";
- }
- else {
+ else
xmlnsprefix = opt_arg;
- }
h5tools_nCols = 0;
break;
/** end XML parameters **/
@@ -1187,7 +1189,7 @@ parse_start:
* the two.
*/
s = last_dset->subset_info;
- }
+ }
else {
last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
}
@@ -1358,7 +1360,7 @@ main(int argc, const char *argv[])
/* Disable tools error reporting */
H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
-
+
if((hand = parse_command_line(argc, argv))==NULL) {
goto done;
}
@@ -1444,12 +1446,12 @@ main(int argc, const char *argv[])
if (xml_dtd_uri == NULL) {
if (useschema) {
xml_dtd_uri = DEFAULT_XSD;
- }
+ }
else {
xml_dtd_uri = DEFAULT_DTD;
xmlnsprefix = "";
}
- }
+ }
else {
if (useschema && HDstrcmp(xmlnsprefix,"")) {
error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
@@ -1486,7 +1488,7 @@ main(int argc, const char *argv[])
/* start to dump - display file header information */
if (!doxml) {
begin_obj(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin);
- }
+ }
else {
PRINTVALSTREAM(rawoutstream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
@@ -1495,7 +1497,7 @@ main(int argc, const char *argv[])
if (HDstrcmp(xmlnsprefix,"") == 0) {
PRINTSTREAM(rawoutstream, "<HDF5-File xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"%s\">\n",
xml_dtd_uri);
- }
+ }
else {
/* TO DO: make -url option work in this case (may need new option) */
char *ns;
@@ -1511,7 +1513,7 @@ main(int argc, const char *argv[])
"http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",xmlnsprefix,ns);
HDfree(ns);
}
- }
+ }
else {
PRINTSTREAM(rawoutstream, "<!DOCTYPE HDF5-File PUBLIC \"HDF5-File.dtd\" \"%s\">\n", xml_dtd_uri);
PRINTVALSTREAM(rawoutstream, "<HDF5-File>\n");
@@ -1570,7 +1572,7 @@ main(int argc, const char *argv[])
if (!doxml) {
end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend);
PRINTVALSTREAM(rawoutstream, "\n");
- }
+ }
else {
PRINTSTREAM(rawoutstream, "</%sHDF5-File>\n", xmlnsprefix);
}
@@ -1591,7 +1593,7 @@ main(int argc, const char *argv[])
}
} /* end while */
- if(hand)
+ if(hand)
free_handler(hand, argc);
/* To Do: clean up XML table */
@@ -1615,7 +1617,7 @@ done:
fname = NULL;
}
- if(hand)
+ if(hand)
free_handler(hand, argc);
/* To Do: clean up XML table */
@@ -1668,20 +1670,20 @@ h5_fileaccess(void)
if (!HDstrcmp(name, "sec2")) {
/* Unix read() and write() system calls */
if (H5Pset_fapl_sec2(fapl)<0) return -1;
- }
+ }
else if (!HDstrcmp(name, "stdio")) {
/* Standard C fread() and fwrite() system calls */
if (H5Pset_fapl_stdio(fapl)<0) return -1;
- }
+ }
else if (!HDstrcmp(name, "core")) {
/* In-core temporary file with 1MB increment */
if (H5Pset_fapl_core(fapl, 1024*1024, FALSE)<0) return -1;
- }
+ }
else if (!HDstrcmp(name, "split")) {
/* Split meta data and raw data each using default driver */
if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0)
return -1;
- }
+ }
else if (!HDstrcmp(name, "multi")) {
/* Multi-file driver, general case of the split driver */
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
@@ -1702,12 +1704,12 @@ h5_fileaccess(void)
memb_map[mt] = mt;
sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];
- memb_addr[mt] = MAX(mt-1,0)*(HADDR_MAX/10);
+ memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
}
if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0)
return -1;
- }
+ }
else if (!HDstrcmp(name, "family")) {
hsize_t fam_size = 100*1024*1024; /*100 MB*/
@@ -1716,7 +1718,7 @@ h5_fileaccess(void)
fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024);
if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
return -1;
- }
+ }
else if (!HDstrcmp(name, "log")) {
long log_flags = H5FD_LOG_LOC_IO;
@@ -1726,12 +1728,12 @@ h5_fileaccess(void)
if (H5Pset_fapl_log(fapl, NULL, (unsigned)log_flags, 0) < 0)
return -1;
- }
+ }
else if (!HDstrcmp(name, "direct")) {
/* Substitute Direct I/O driver with sec2 driver temporarily because
* some output has sec2 driver as the standard. */
if (H5Pset_fapl_sec2(fapl)<0) return -1;
- }
+ }
else {
/* Unknown driver */
return -1;
diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h
index a1f5b22..e9b8233 100644
--- a/tools/h5dump/h5dump.h
+++ b/tools/h5dump/h5dump.h
@@ -39,11 +39,11 @@ typedef struct dump_functions_t {
/* List of table structures. There is one table structure for each file */
typedef struct h5dump_table_items_t {
- unsigned long fileno; /* File number that these tables refer to */
- hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
- table_t *group_table; /* Table of groups */
- table_t *dset_table; /* Table of datasets */
- table_t *type_table; /* Table of datatypes */
+ unsigned long fileno; /* File number that these tables refer to */
+ hid_t oid; /* ID of an object in this file, held open so fileno is consistent */
+ table_t *group_table; /* Table of groups */
+ table_t *dset_table; /* Table of datasets */
+ table_t *type_table; /* Table of datatypes */
} h5dump_table_items_t;
typedef struct h5dump_table_list_t {
size_t nalloc;
@@ -53,7 +53,7 @@ typedef struct h5dump_table_list_t {
h5dump_table_list_t table_list = {0, 0, NULL};
table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL;
-int dump_indent = 0; /*how far in to indent the line */
+unsigned dump_indent = 0; /*how far in to indent the line */
int unamedtype = 0; /* shared datatype with no name */
hbool_t hit_elink = FALSE; /* whether we have traversed an external link */
@@ -74,7 +74,6 @@ int display_fi = FALSE; /*file index */
int display_ai = TRUE; /*array index */
int display_escape = FALSE; /*escape non printable characters */
int display_region = FALSE; /*print region reference data */
-int enable_error_stack= FALSE; /* re-enable error stack */
int disable_compact_subset= FALSE; /* disable compact form of subset notation */
int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/
int include_attrs = TRUE; /* Display attributes */
@@ -84,13 +83,13 @@ 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 */
+#define PACKED_BITS_SIZE_MAX (8*sizeof(long long)) /* Maximum bits size of integer types of packed-bits */
/* mask list for packed bits */
unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
/* packed bits display parameters */
-int packed_offset[PACKED_BITS_MAX];
-int packed_length[PACKED_BITS_MAX];
+unsigned packed_offset[PACKED_BITS_MAX];
+unsigned packed_length[PACKED_BITS_MAX];
/*
* The global table is set to either ddl_function_table or
diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c
index 0324a52..c0b1833 100644
--- a/tools/h5dump/h5dump_ddl.c
+++ b/tools/h5dump/h5dump_ddl.c
@@ -26,12 +26,12 @@
typedef struct {
hid_t fid; /* File ID being traversed */
- char *op_name; /* Object name wanted */
+ const char *op_name; /* Object name wanted */
} trav_handle_udata_t;
typedef struct {
- char *path; /* Path of object being searched */
- char *op_name; /* Object name wanted */
+ const char *path; /* Path of object being searched */
+ const char *op_name; /* Object name wanted */
} trav_attr_udata_t;
/* callback function used by H5Literate() */
@@ -59,7 +59,7 @@ dump_datatype(hid_t type)
h5tool_format_t *outputformat = &h5tools_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent/COL;
+ ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
h5dump_type_table = type_table;
@@ -88,9 +88,9 @@ dump_dataspace(hid_t space)
h5tool_format_t *outputformat = &h5tools_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent/COL;
+ ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space);
}
@@ -117,19 +117,19 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
h5tools_context_t ctx; /* print context */
h5tool_format_t *outputformat = &h5tools_dataformat;
h5tool_format_t string_dataformat;
-
+
hid_t attr_id;
herr_t ret = SUCCEED;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent/COL;
+ ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
oid_output = display_oid;
data_output = display_data;
attr_data_output = display_attr_data;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -137,7 +137,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
+ if (h5tools_nCols == 0) {
string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
@@ -155,7 +155,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
-
+
return ret;
}
@@ -197,9 +197,9 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent/COL;
+ ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -207,7 +207,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
+ if (h5tools_nCols == 0) {
string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
@@ -222,8 +222,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
if(!obj_path) {
ret = FAIL;
goto done;
- }
-
+ }
+
HDstrcpy(obj_path, prefix);
HDstrcat(obj_path, "/");
HDstrcat(obj_path, name);
@@ -310,7 +310,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
ret = FAIL;
H5Dclose(obj);
goto done;
- }
+ }
else if(found_obj->displayed) {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -349,7 +349,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
H5Dclose(obj);
goto done;
- }
+ }
else {
found_obj->displayed = TRUE;
}
@@ -357,7 +357,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
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);
@@ -370,7 +370,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
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);
@@ -408,7 +408,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
error_msg("unable to get link value\n");
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
- }
+ }
else {
/* print the value of a soft link */
/* Standard DDL: no modification */
@@ -558,7 +558,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
done:
h5tools_str_close(&buffer);
-
+
if(obj_path)
HDfree(obj_path);
return ret;
@@ -648,9 +648,9 @@ dump_named_datatype(hid_t tid, const char *name)
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent/COL;
+ ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -658,7 +658,7 @@ dump_named_datatype(hid_t tid, const char *name)
string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
+ if (h5tools_nCols == 0) {
string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
@@ -685,7 +685,7 @@ dump_named_datatype(hid_t tid, const char *name)
}
ctx.need_prefix = TRUE;
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s \"%s\" %s",
@@ -718,7 +718,7 @@ dump_named_datatype(hid_t tid, const char *name)
else
found_obj->displayed = TRUE;
} /* end if */
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_print_datatype(rawoutstream, &buffer, outputformat, &ctx, tid, FALSE);
@@ -726,7 +726,7 @@ dump_named_datatype(hid_t tid, const char *name)
if(H5Tget_class(tid) != H5T_COMPOUND) {
h5tools_str_append(&buffer, ";");
}
-
+
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* print attributes */
@@ -811,9 +811,9 @@ dump_group(hid_t gid, const char *name)
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent/COL;
+ ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -821,7 +821,7 @@ dump_group(hid_t gid, const char *name)
string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
+ if (h5tools_nCols == 0) {
string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
@@ -839,7 +839,7 @@ dump_group(hid_t gid, const char *name)
h5tools_dump_header_format->groupbegin, name,
h5tools_dump_header_format->groupblockbegin);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
+
ctx.indent_level++;
dump_indent += COL;
@@ -858,9 +858,8 @@ dump_group(hid_t gid, const char *name)
}
} /* end if */
- if(display_oid) {
+ if(display_oid)
h5tools_dump_oid(rawoutstream, outputformat, &ctx, gid);
- }
h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid);
@@ -946,9 +945,9 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
hsize_t curr_pos = 0; /* total data element position */
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent/COL;
+ ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
-
+
string_dataformat = *outputformat;
if (fp_format) {
@@ -956,7 +955,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
+ if (h5tools_nCols == 0) {
string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
@@ -982,7 +981,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s \"%s\" %s",
@@ -994,7 +993,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
dump_indent += COL;
ctx.indent_level++;
-
+
type = H5Dget_type(did);
h5dump_type_table = type_table;
h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type);
@@ -1016,19 +1015,20 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
H5Pclose(dcpl_id);
if(display_data) {
- int data_loop = 1;
- int i;
+ unsigned data_loop = 1;
+ unsigned u;
+
if(display_packed_bits)
data_loop = packed_bits_num;
- for(i=0; i<data_loop; i++) {
+ for(u = 0; u < data_loop; u++) {
if(display_packed_bits) {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
/* Render the element */
h5tools_str_reset(&buffer);
- packed_data_mask = packed_mask[i];
- packed_data_offset = packed_offset[i];
- packed_data_length = packed_length[i];
+ packed_data_mask = packed_mask[u];
+ packed_data_offset = packed_offset[u];
+ packed_data_length = packed_length[u];
h5tools_print_packed_bits(&buffer, type);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
@@ -1042,7 +1042,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "DATA{ not yet implemented.}");
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
-
+
ctx.indent_level--;
break;
@@ -1067,7 +1067,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
HDassert(0);
break;
} /* end switch */
- } /* for(i=0;i<data_loop;i++) */
+ } /* for(u=0; u<data_loop; u++) */
}
H5Tclose(type);
@@ -1079,7 +1079,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
+
/* Render the element */
h5tools_str_reset(&buffer);
if(HDstrlen(h5tools_dump_header_format->datasetblockend)) {
@@ -1124,7 +1124,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
+ if (h5tools_nCols == 0) {
string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
@@ -1135,7 +1135,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
outputformat = &string_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent/COL;
+ ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
if(obj_data == DATASET_DATA)
@@ -1189,7 +1189,7 @@ dump_fcpl(hid_t fid)
fdriver=H5Pget_driver(fapl);
H5Pclose(fapl);
#endif
-
+
/*-------------------------------------------------------------------------
* SUPER_BLOCK
*-------------------------------------------------------------------------
@@ -1279,9 +1279,8 @@ dump_fcontents(hid_t fid)
unsigned u;
for (u = 0; u < type_table->nobjs; u++) {
- if (!type_table->objs[u].recorded) {
+ if (!type_table->objs[u].recorded)
PRINTSTREAM(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno);
- }
}
}
@@ -1295,54 +1294,54 @@ static herr_t
attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data)
{
herr_t ret = SUCCEED;
- int i;
- int j;
- int k;
- char *obj_op_name;
+ int j;
+ char *obj_op_name;
char *obj_name;
- trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data;
- char *buf = attr_data->path;
- char *op_name = attr_data->op_name;
+ trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data;
+ const char *buf = attr_data->path;
+ const char *op_name = attr_data->op_name;
j = (int)HDstrlen(op_name) - 1;
/* find the last / */
while(j >= 0) {
- if (op_name[j] == '/' && (j==0 || (j>0 && op_name[j-1]!='\\')))
- break;
- j--;
+ if(op_name[j] == '/' && (j == 0 || (j > 0 && op_name[j - 1] != '\\')))
+ break;
+ j--;
}
obj_op_name = h5tools_str_replace(op_name + j + 1, "\\/", "/");
if(obj_op_name == NULL) {
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
}
else {
- if(HDstrcmp(attr_name, obj_op_name)==0) {
- /* object name */
- i = (int)HDstrlen(buf);
- j = (int)HDstrlen(op_name);
- k = (size_t)i + 1 + (size_t)j + 1 + 2;
- obj_name = (char *)HDmalloc((size_t)k);
- if(obj_name == NULL) {
- h5tools_setstatus(EXIT_FAILURE);
- ret = FAIL;
- }
- else {
- HDmemset(obj_name, '\0', (size_t)k);
- if(op_name[0] != '/') {
- HDstrncat(obj_name, buf, (size_t)i + 1);
- if(buf[i-1] != '/')
- HDstrncat(obj_name, "/", (size_t)2);
- }
- HDstrncat(obj_name, op_name, (size_t)j + 1);
-
- handle_attributes(oid, obj_name, NULL, 0, NULL);
- HDfree(obj_name);
- }
- }
- HDfree(obj_op_name);
+ if(HDstrcmp(attr_name, obj_op_name)==0) {
+ size_t u, v, w;
+
+ /* object name */
+ u = HDstrlen(buf);
+ v = HDstrlen(op_name);
+ w = u + 1 + v + 1 + 2;
+ obj_name = (char *)HDmalloc(w);
+ if(obj_name == NULL) {
+ h5tools_setstatus(EXIT_FAILURE);
+ ret = FAIL;
+ }
+ else {
+ HDmemset(obj_name, '\0', w);
+ if(op_name[0] != '/') {
+ HDstrncat(obj_name, buf, u + 1);
+ if(buf[u - 1] != '/')
+ HDstrncat(obj_name, "/", (size_t)2);
+ }
+ HDstrncat(obj_name, op_name, v + 1);
+
+ handle_attributes(oid, obj_name, NULL, 0, NULL);
+ HDfree(obj_name);
+ }
+ }
+ HDfree(obj_op_name);
}
return ret;
} /* end attr_search() */
@@ -1350,31 +1349,34 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a
static herr_t
obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data)
{
- trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
- char *op_name = (char*)handle_data->op_name;
-
+ trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
+ const char *op_name = handle_data->op_name;
trav_attr_udata_t attr_data;
- attr_data.path = (char*)path;
+
+ attr_data.path = path;
attr_data.op_name = op_name;
H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search, (void*)&attr_data, H5P_DEFAULT);
- if(HDstrcmp(path, op_name)==0) {
- switch(oi->type) {
- case H5O_TYPE_GROUP:
- handle_groups(handle_data->fid, path, NULL, 0, NULL);
- break;
- case H5O_TYPE_DATASET:
- handle_datasets(handle_data->fid, path, NULL, 0, NULL);
- break;
- case H5O_TYPE_NAMED_DATATYPE:
- handle_datatypes(handle_data->fid, path, NULL, 0, NULL);
- break;
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- error_msg("unknown object type value\n");
- h5tools_setstatus(EXIT_FAILURE);
- } /* end switch */
+ if(HDstrcmp(path, op_name) == 0) {
+ switch(oi->type) {
+ case H5O_TYPE_GROUP:
+ handle_groups(handle_data->fid, path, NULL, 0, NULL);
+ break;
+
+ case H5O_TYPE_DATASET:
+ handle_datasets(handle_data->fid, path, NULL, 0, NULL);
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ handle_datatypes(handle_data->fid, path, NULL, 0, NULL);
+ break;
+
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ error_msg("unknown object type value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end switch */
}
return 0;
@@ -1383,49 +1385,48 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al
static herr_t
lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
{
- int search_len;
- int k;
+ size_t search_len;
+ size_t k;
char *search_name;
- trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
- char *op_name = (char*)handle_data->op_name;
+ trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
+ const char *op_name = handle_data->op_name;
search_len = HDstrlen(op_name);
- if(search_len > 0 && op_name[0] != '/') {
- k = 2;
- }
+ if(search_len > 0 && op_name[0] != '/')
+ k = 2;
else
k = 1;
- search_name = (char *)HDmalloc((size_t)(search_len + k));
+ search_name = (char *)HDmalloc(search_len + k);
if(search_name == NULL) {
- error_msg("creating temporary link\n");
- h5tools_setstatus(EXIT_FAILURE);
+ error_msg("creating temporary link\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
else {
- if (k == 2) {
- HDstrcpy(search_name, "/");
- HDstrncat(search_name, op_name, (size_t)search_len + 1);
- }
- else
- HDstrncpy(search_name, op_name, (size_t)search_len + 1);
- search_name[search_len + k - 1] = '\0';
-
- if(HDstrcmp(path, search_name) == 0) {
- switch(li->type) {
- case H5L_TYPE_SOFT:
- case H5L_TYPE_EXTERNAL:
- handle_links(handle_data->fid, op_name, NULL, 0, NULL);
- break;
-
- case H5L_TYPE_HARD:
- case H5L_TYPE_MAX:
- case H5L_TYPE_ERROR:
- default:
- error_msg("unknown link type value\n");
- h5tools_setstatus(EXIT_FAILURE);
- break;
- } /* end switch() */
- }
- HDfree(search_name);
+ if (k == 2) {
+ HDstrcpy(search_name, "/");
+ HDstrncat(search_name, op_name, search_len + 1);
+ }
+ else
+ HDstrncpy(search_name, op_name, search_len + 1);
+ search_name[search_len + k - 1] = '\0';
+
+ if(HDstrcmp(path, search_name) == 0) {
+ switch(li->type) {
+ case H5L_TYPE_SOFT:
+ case H5L_TYPE_EXTERNAL:
+ handle_links(handle_data->fid, op_name, NULL, 0, NULL);
+ break;
+
+ case H5L_TYPE_HARD:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_ERROR:
+ default:
+ error_msg("unknown link type value\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ break;
+ } /* end switch() */
+ }
+ HDfree(search_name);
}
return 0;
} /* end lnk_search() */
@@ -1452,7 +1453,7 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
hid_t gcpl_id;
unsigned crt_order_flags;
unsigned attr_crt_order_flags;
- trav_handle_udata_t handle_udata; /* User data for traversal */
+ trav_handle_udata_t handle_udata; /* User data for traversal */
if ((gcpl_id = H5Gget_create_plist(gid)) < 0) {
error_msg("error in getting group creation property list ID\n");
@@ -1476,12 +1477,12 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
h5tools_setstatus(EXIT_FAILURE);
}
- handle_udata.fid = fid;
- handle_udata.op_name = (char*)path_name;
- if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) {
- error_msg("error traversing information\n");
- h5tools_setstatus(EXIT_FAILURE);
- }
+ handle_udata.fid = fid;
+ handle_udata.op_name = path_name;
+ if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) {
+ error_msg("error traversing information\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ }
}
}
@@ -1505,8 +1506,8 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
void
handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
{
- hid_t oid = -1;
- hid_t attr_id = -1;
+ hid_t oid = -1;
+ hid_t attr_id = -1;
char *obj_name = NULL;
char *attr_name = NULL;
int j;
@@ -1523,7 +1524,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H
/* find the last / */
while(j >= 0) {
- if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\')))
+ if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\')))
break;
j--;
}
@@ -1538,7 +1539,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H
dump_indent += COL;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent/COL;
+ ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
string_dataformat = *outputformat;
@@ -1548,7 +1549,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H
string_dataformat.fmt_float = fp_format;
}
- if (h5tools_nCols==0) {
+ if (h5tools_nCols == 0) {
string_dataformat.line_ncols = 65535;
string_dataformat.line_per_line = 1;
}
@@ -1558,7 +1559,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H
string_dataformat.do_escape = display_escape;
outputformat = &string_dataformat;
- attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/");
+ attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/");
/* handle error case: cannot open the object with the attribute */
if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) {
@@ -1614,7 +1615,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H
} /* end if */
HDfree(obj_name);
- HDfree(attr_name);
+ HDfree(attr_name);
dump_indent -= COL;
return;
@@ -1622,9 +1623,9 @@ error:
h5tools_setstatus(EXIT_FAILURE);
if(obj_name)
HDfree(obj_name);
-
- if (attr_name)
- HDfree(attr_name);
+
+ if (attr_name)
+ HDfree(attr_name);
H5E_BEGIN_TRY {
H5Oclose(oid);
@@ -1681,8 +1682,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
h5tools_setstatus(EXIT_FAILURE);
return;
}
- else
- ndims = ndims_res;
+ ndims = (unsigned)ndims_res;
if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) {
/* they didn't specify a ``stride'' or ``block''. default to 1 in all
@@ -1739,7 +1739,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
h5tools_setstatus(EXIT_FAILURE);
return;
}
-
+
/*-------------------------------------------------------------------------
* check for block overlap
*-------------------------------------------------------------------------
@@ -1772,7 +1772,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
PRINTSTREAM(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname);
indentation(dump_indent);
end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend);
- }
+ }
else {
found_obj->displayed = TRUE;
dump_indent += COL;
@@ -1871,11 +1871,11 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
error_msg("unable to get link info from \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
- }
+ }
else if(linfo.type == H5L_TYPE_HARD) {
error_msg("\"%s\" is a hard link\n", links);
h5tools_setstatus(EXIT_FAILURE);
- }
+ }
else {
char *buf = (char *)HDmalloc(linfo.u.val_size);
PRINTVALSTREAM(rawoutstream, "\n");
@@ -1912,12 +1912,12 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT
PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file);
indentation(COL);
PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path);
- }
+ }
else {
error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
- }
+ }
else {
error_msg("h5dump error: unable to get external link value for \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
@@ -2091,12 +2091,15 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
case H5O_TYPE_GROUP:
handle_groups(group, linkname, NULL, 0, objname);
break;
+
case H5O_TYPE_DATASET:
handle_datasets(group, linkname, NULL, 0, objname);
break;
+
case H5O_TYPE_NAMED_DATATYPE:
handle_datatypes(group, linkname, NULL, 0, objname);
break;
+
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 547f61a..9573ee8 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -33,7 +33,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) { \
@@ -54,12 +54,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
@@ -67,10 +67,10 @@ 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;
}
/*-------------------------------------------------------------------------
@@ -130,20 +130,6 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- if (!options->fs_strategy) {
- if (H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0) {
- error_msg("failed to retrieve file space strategy\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
- }
- }
-
- if (!options->fs_threshold) {
- if (H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0) {
- error_msg("failed to retrieve file space threshold\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
- }
- }
-
if (H5Pclose(fcpl_in) < 0) {
error_msg("failed to close property list\n");
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
@@ -314,12 +300,6 @@ print_user_block(fnamein, fidin);
}
}
- /* set file space strategy and free space threshold */
- if (H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0) {
- error_msg("failed to set file space strategy & threshold \n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
- }
-
/*-------------------------------------------------------------------------
* create the output file
*-------------------------------------------------------------------------
@@ -679,7 +659,7 @@ 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 */
@@ -1517,65 +1497,65 @@ 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");
+ 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)) < 0) {
+ /* open file */
+ if((fh = HDopen(filename, O_RDONLY, 0)) < 0) {
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/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index f393dd1..e68ea18 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -207,12 +207,10 @@ h5repack_verify(const char *out_fname, pack_opt_t *options)
done:
H5E_BEGIN_TRY {
- H5Pclose(fcpl_in);
H5Pclose(fcpl_out);
H5Pclose(pid);
H5Sclose(sid);
H5Dclose(did);
- H5Fclose(fidin);
H5Fclose(fidout);
if (travt)
trav_table_free(travt);
@@ -527,7 +525,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 */
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index aefd641..ab3e1ce 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -78,8 +78,6 @@ void print_type(hid_t type)
{
switch (H5Tget_class(type))
{
- default:
- return;
case H5T_INTEGER:
if (H5Tequal(type, H5T_STD_I8BE)) {
parallel_print("H5T_STD_I8BE");
@@ -160,7 +158,21 @@ void print_type(hid_t type)
}
break;
- }/*switch*/
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
+ return;
+
+ } /* end switch */
}
/*-------------------------------------------------------------------------
@@ -179,16 +191,16 @@ diff_basename(const char *name)
{
size_t i;
- if (name==NULL)
+ if (name == NULL)
return NULL;
/* Find the end of the base name */
i = HDstrlen(name);
- while (i>0 && '/'==name[i-1])
+ while (i > 0 && '/' == name[i - 1])
--i;
/* Skip backward over base name */
- while (i>0 && '/'!=name[i-1])
+ while (i > 0 && '/' != name[i - 1])
--i;
return(name+i);
@@ -211,14 +223,20 @@ get_type(h5trav_type_t type)
switch(type) {
case H5TRAV_TYPE_DATASET:
return("H5G_DATASET");
+
case H5TRAV_TYPE_GROUP:
return("H5G_GROUP");
+
case H5TRAV_TYPE_NAMED_DATATYPE:
return("H5G_TYPE");
+
case H5TRAV_TYPE_LINK:
return("H5G_LINK");
+
case H5TRAV_TYPE_UDLINK:
return("H5G_UDLINK");
+
+ case H5TRAV_TYPE_UNKNOWN:
default:
return("unknown type");
}
@@ -242,13 +260,22 @@ get_sign(H5T_sign_t sign)
{
switch (sign)
{
- default:
- return("H5T_SGN_ERROR");
- case H5T_SGN_NONE:
- return("H5T_SGN_NONE");
- case H5T_SGN_2:
- return("H5T_SGN_2");
- }
+ case H5T_SGN_NONE:
+ return "H5T_SGN_NONE";
+
+ case H5T_SGN_2:
+ return "H5T_SGN_2";
+
+ case H5T_SGN_ERROR:
+ return "H5T_SGN_ERROR";
+
+ case H5T_NSGN:
+ return "H5T_NSGN";
+
+ default:
+ HDassert(0);
+ return "unknown sign value";
+ } /* end switch */
}
@@ -266,34 +293,47 @@ get_sign(H5T_sign_t sign)
const char*
get_class(H5T_class_t tclass)
{
- switch (tclass)
- {
- default:
- return("Invalid class");
- case H5T_TIME:
- return("H5T_TIME");
- case H5T_INTEGER:
- return("H5T_INTEGER");
- case H5T_FLOAT:
- return("H5T_FLOAT");
- case H5T_STRING:
- return("H5T_STRING");
- case H5T_BITFIELD:
- return("H5T_BITFIELD");
- case H5T_OPAQUE:
- return("H5T_OPAQUE");
- case H5T_COMPOUND:
- return("H5T_COMPOUND");
- case H5T_REFERENCE:
- return("H5T_REFERENCE");
- case H5T_ENUM:
- return("H5T_ENUM");
- case H5T_VLEN:
- return("H5T_VLEN");
- case H5T_ARRAY:
- return("H5T_ARRAY");
- }
-}
+ switch (tclass) {
+ case H5T_TIME:
+ return("H5T_TIME");
+
+ case H5T_INTEGER:
+ return("H5T_INTEGER");
+
+ case H5T_FLOAT:
+ return("H5T_FLOAT");
+
+ case H5T_STRING:
+ return("H5T_STRING");
+
+ case H5T_BITFIELD:
+ return("H5T_BITFIELD");
+
+ case H5T_OPAQUE:
+ return("H5T_OPAQUE");
+
+ case H5T_COMPOUND:
+ return("H5T_COMPOUND");
+
+ case H5T_REFERENCE:
+ return("H5T_REFERENCE");
+
+ case H5T_ENUM:
+ return("H5T_ENUM");
+
+ case H5T_VLEN:
+ return("H5T_VLEN");
+
+ case H5T_ARRAY:
+ return("H5T_ARRAY");
+
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
+ HDassert(0);
+ return("Invalid class");
+ } /* end switch */
+} /* end get_class() */
/*-------------------------------------------------------------------------
* Function: print_found
@@ -304,10 +344,10 @@ get_class(H5T_class_t tclass)
*/
void print_found(hsize_t nfound)
{
- if(g_Parallel)
- parallel_print("%"H5_PRINTF_LL_WIDTH"u differences found\n", (unsigned long long)nfound);
- else
- HDfprintf(stdout,"%Hu differences found\n",nfound);
+ if(g_Parallel)
+ parallel_print("%"H5_PRINTF_LL_WIDTH"u differences found\n", (unsigned long long)nfound);
+ else
+ HDfprintf(stdout,"%Hu differences found\n",nfound);
}
@@ -354,3 +394,4 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
out:
return ret;
}
+
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index a21dea7..f2123fb 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -47,10 +47,11 @@ int region_output; /* region output */
int oid_output; /* oid output */
int data_output; /* data output */
int attr_data_output; /* attribute data output */
-int packed_bits_num; /* number of packed bits to display */
-int packed_data_offset; /* offset of packed bits to display */
-int packed_data_length; /* lengtht of packed bits to display */
+unsigned packed_bits_num; /* number of packed bits to display */
+unsigned packed_data_offset; /* offset of packed bits to display */
+unsigned packed_data_length; /* length of packed bits to display */
unsigned long long packed_data_mask; /* mask in which packed bits to display */
+int enable_error_stack= FALSE; /* re-enable error stack */
/* module-scoped variables */
static int h5tools_init_g; /* if h5tools lib has been initialized */
@@ -805,7 +806,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
h5tools_str_t prefix;
h5tools_str_t str; /*temporary for indentation */
size_t templength = 0;
- int i, indentlevel = 0;
+ unsigned u, indentlevel = 0;
if (stream == NULL)
return;
@@ -827,10 +828,9 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
h5tools_str_prefix(&prefix, info, elmtno, ctx->ndims, ctx);
/* Write new prefix to output */
- if (ctx->indent_level >= 0) {
+ if (ctx->indent_level > 0)
indentlevel = ctx->indent_level;
- }
- else {
+ else
/*
* This is because sometimes we don't print out all the header
* info for the data (like the tattr-2.ddl example). If that happens
@@ -838,29 +838,23 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
* just print out the default indent levels.
*/
indentlevel = ctx->default_indent_level;
- }
/* when printing array indices, print the indentation before the prefix
the prefix is printed one indentation level before */
- if (info->pindex) {
- for (i = 0; i < indentlevel - 1; i++) {
+ if (info->pindex)
+ for (u = 0; u < indentlevel - 1; u++)
PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream);
- }
- }
- if (elmtno == 0 && secnum == 0 && info->line_1st) {
+ if (elmtno == 0 && secnum == 0 && info->line_1st)
PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream);
- }
- else if (secnum && info->line_cont) {
+ else if (secnum && info->line_cont)
PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream);
- }
- else {
+ else
PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream);
- }
templength = h5tools_str_len(&prefix);
- for (i = 0; i < indentlevel; i++) {
+ for (u = 0; u < indentlevel; u++)
/*we already made the indent for the array indices case */
if (!info->pindex) {
PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_indent), stream);
@@ -870,7 +864,6 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
/*we cannot count the prefix for the array indices case */
templength += h5tools_str_len(&str);
}
- }
ctx->cur_column = ctx->prev_prefix_len = templength;
ctx->cur_elmt = 0;
@@ -900,7 +893,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
h5tools_str_t prefix;
h5tools_str_t str; /*temporary for indentation */
size_t templength = 0;
- int i, indentlevel = 0;
+ unsigned u, indentlevel = 0;
if (stream == NULL)
return;
@@ -922,7 +915,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx->ndims, ctx->p_max_idx, ctx);
/* Write new prefix to output */
- if (ctx->indent_level >= 0)
+ if (ctx->indent_level > 0)
indentlevel = ctx->indent_level;
else
/*
@@ -936,20 +929,19 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
/* when printing array indices, print the indentation before the prefix
the prefix is printed one indentation level before */
if (info->pindex)
- for (i = 0; i < indentlevel - 1; i++) {
+ for (u = 0; u < indentlevel - 1; u++)
PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream);
- }
- if (elmtno == 0 && secnum == 0 && info->line_1st) {
+ if (elmtno == 0 && secnum == 0 && info->line_1st)
PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream);
- } else if (secnum && info->line_cont) {
+ else if (secnum && info->line_cont)
PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream);
- } else
+ else
PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream);
templength = h5tools_str_len(&prefix);
- for (i = 0; i < indentlevel; i++) {
+ for (u = 0; u < indentlevel; u++)
/*we already made the indent for the array indices case */
if (!info->pindex) {
PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_indent), stream);
@@ -959,7 +951,6 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
/*we cannot count the prefix for the array indices case */
templength += h5tools_str_len(&str);
}
- }
ctx->cur_column = ctx->prev_prefix_len = templength;
ctx->cur_elmt = 0;
@@ -1299,9 +1290,8 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
HDassert(ctx->ndims);
ctx->acc[ctx->ndims - 1] = 1;
- for (i = (ctx->ndims - 2); i >= 0; i--) {
+ for (i = ((int)ctx->ndims - 2); i >= 0; i--)
ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1];
- }
for (j = 0; j < ctx->ndims; j++)
ctx->pos[j] = 0;
}
@@ -1536,18 +1526,18 @@ CATCH
*/
int
render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
- hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
+ hid_t container, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata)
{
hsize_t *dims1 = NULL;
hsize_t *start = NULL;
hsize_t *count = NULL;
hsize_t numelem;
hsize_t total_size[H5S_MAX_RANK];
- int jndx;
+ unsigned jndx;
size_t type_size;
hid_t mem_space = -1;
void *region_buf = NULL;
- int blkndx;
+ hsize_t blkndx;
hid_t sid1 = -1;
int ret_value = SUCCEED;
@@ -1567,7 +1557,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
}
/* Create dataspace for reading buffer */
- if((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0)
+ if((mem_space = H5Screate_simple((int)ndims, dims1, NULL)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed");
if((type_size = H5Tget_size(type_id)) == 0)
@@ -1640,7 +1630,8 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
hsize_t nblocks;
hsize_t alloc_size;
hsize_t *ptdata;
- int ndims;
+ int sndims;
+ unsigned ndims;
hid_t dtype = -1;
hid_t type_id = -1;
@@ -1649,16 +1640,16 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
nblocks = (hsize_t)snblocks;
/* Print block information */
- if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0)
+ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ ndims = (unsigned)sndims;
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL)
HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
- H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t);
- if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0)
+ if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, nblocks, ptdata) < 0)
HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed");
if((dtype = H5Dget_type(region_id)) < 0)
@@ -1705,10 +1696,10 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
int
render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
FILE *stream, hid_t container,
- int ndims, hid_t type_id, hssize_t npoints)
+ unsigned ndims, hid_t type_id, hsize_t npoints)
{
hsize_t *dims1 = NULL;
- int type_size;
+ size_t type_size;
hid_t mem_space = -1;
void *region_buf = NULL;
int ret_value = SUCCEED;
@@ -1763,17 +1754,21 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id,
FILE *stream, hid_t container)
{
HERR_INIT(hbool_t, TRUE)
- hssize_t npoints;
- int ndims;
+ hssize_t snpoints;
+ hsize_t npoints;
+ int sndims;
+ unsigned ndims;
hid_t dtype = -1;
hid_t type_id = -1;
- if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0)
+ if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed");
+ npoints = (hsize_t)snpoints;
/* Allocate space for the dimension array */
- if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0)
+ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ ndims = (unsigned)sndims;
if((dtype = H5Dget_type(region_id)) < 0)
HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Dget_type failed");
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 5c08f33..b548100 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -37,10 +37,10 @@
#define H5TOOLS_DUMP_MAX_RANK H5S_MAX_RANK
/* Stream macros */
-#define FLUSHSTREAM(S) {if(S != NULL) HDfflush(S);}
-#define PRINTSTREAM(S, F, ...) {if(S != NULL) HDfprintf(S, F, __VA_ARGS__);}
-#define PRINTVALSTREAM(S, V) {if(S != NULL) HDfprintf(S, V);}
-#define PUTSTREAM(X,S) {if(S != NULL) HDfputs(X, S);}
+#define FLUSHSTREAM(S) if(S != NULL) HDfflush(S)
+#define PRINTSTREAM(S, F, ...) if(S != NULL) HDfprintf(S, F, __VA_ARGS__)
+#define PRINTVALSTREAM(S, V) if(S != NULL) HDfprintf(S, V)
+#define PUTSTREAM(X,S) do { if(S != NULL) HDfputs(X, S); } while(0)
/*
* Strings for output - these were duplicated from the h5dump.h
@@ -81,7 +81,7 @@
#define FLETCHER32 "CHECKSUM FLETCHER32"
#define SZIP "COMPRESSION SZIP"
#define NBIT "COMPRESSION NBIT"
-#define SCALEOFFSET "COMPRESSION SCALEOFFSET"
+#define SCALEOFFSET "COMPRESSION SCALEOFFSET"
#define SCALEOFFSET_MINBIT "MIN BITS"
#define STORAGE_LAYOUT "STORAGE_LAYOUT"
#define CONTIGUOUS "CONTIGUOUS"
@@ -275,7 +275,7 @@ typedef struct h5tool_format_t {
const char *fmt_float;
int ascii;
int str_locale;
- int str_repeat;
+ unsigned str_repeat;
/*
* Fields associated with compound array members.
@@ -491,9 +491,9 @@ typedef struct h5tools_context_t {
hsize_t size_last_dim; /*the size of the last dimension,
*needed so we can break after each
*row */
- int indent_level; /*the number of times we need some
+ unsigned indent_level; /*the number of times we need some
*extra indentation */
- int default_indent_level; /*this is used when the indent level gets changed */
+ unsigned default_indent_level; /*this is used when the indent level gets changed */
hsize_t acc[H5S_MAX_RANK]; /* accumulator position */
hsize_t pos[H5S_MAX_RANK]; /* matrix position */
hsize_t sm_pos; /* current stripmine element position */
@@ -526,9 +526,9 @@ H5TOOLS_DLLVAR const h5tools_dump_header_t* h5tools_dump_header_format;
extern "C" {
#endif
-H5TOOLS_DLLVAR int packed_bits_num; /* number of packed bits to display */
-H5TOOLS_DLLVAR int packed_data_offset; /* offset of packed bits to display */
-H5TOOLS_DLLVAR int packed_data_length; /* lengtht of packed bits to display */
+H5TOOLS_DLLVAR unsigned packed_bits_num; /* number of packed bits to display */
+H5TOOLS_DLLVAR unsigned packed_data_offset; /* offset of packed bits to display */
+H5TOOLS_DLLVAR unsigned packed_data_length; /* length of packed bits to display */
H5TOOLS_DLLVAR unsigned long long packed_data_mask; /* mask in which packed bits to display */
H5TOOLS_DLLVAR FILE *rawattrstream; /* output stream for raw attribute data */
H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */
@@ -542,6 +542,9 @@ H5TOOLS_DLLVAR int oid_output; /* oid output */
H5TOOLS_DLLVAR int data_output; /* data output */
H5TOOLS_DLLVAR int attr_data_output; /* attribute data output */
+/* things to display or which are set via command line parameters */
+H5TOOLS_DLLVAR int enable_error_stack; /* re-enable error stack */
+
/* Strings for output */
#define H5_TOOLS_GROUP "GROUP"
#define H5_TOOLS_DATASET "DATASET"
@@ -550,11 +553,11 @@ H5TOOLS_DLLVAR int attr_data_output; /* attribute data output */
/* Definitions of useful routines */
H5TOOLS_DLL void h5tools_init(void);
H5TOOLS_DLL void h5tools_close(void);
-H5TOOLS_DLL int h5tools_set_data_output_file(const char *fname, int is_bin);
-H5TOOLS_DLL int h5tools_set_attr_output_file(const char *fname, int is_bin);
-H5TOOLS_DLL int h5tools_set_input_file(const char *fname, int is_bin);
-H5TOOLS_DLL int h5tools_set_output_file(const char *fname, int is_bin);
-H5TOOLS_DLL int h5tools_set_error_file(const char *fname, int is_bin);
+H5TOOLS_DLL int h5tools_set_data_output_file(const char *fname, int is_bin);
+H5TOOLS_DLL int h5tools_set_attr_output_file(const char *fname, int is_bin);
+H5TOOLS_DLL int h5tools_set_input_file(const char *fname, int is_bin);
+H5TOOLS_DLL int h5tools_set_output_file(const char *fname, int is_bin);
+H5TOOLS_DLL int h5tools_set_error_file(const char *fname, int is_bin);
H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl,
const char *driver, char *drivername, size_t drivername_len);
H5TOOLS_DLL hid_t h5tools_get_native_type(hid_t type);
@@ -574,8 +577,12 @@ H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_form
h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum);
H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts);
+H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
+ hid_t container, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata);
H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
FILE *stream, hid_t container);
+H5TOOLS_DLL int render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
+ FILE* stream, hid_t container, unsigned ndims, hid_t type_id, hsize_t npoints);
H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id,
FILE *stream, hid_t container);
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 2c2a06f..3928837 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -198,10 +198,10 @@ hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
size_t ncols, hsize_t region_elmt_counter/*element counter*/,
hsize_t elmt_counter);
-int h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
+static int h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx,
h5tools_str_t *buffer, size_t ncols,
- int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata);
+ unsigned ndims, hid_t type_id, hsize_t npoints, hsize_t *ptdata);
hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
FILE *stream, const h5tool_format_t *info,
@@ -634,10 +634,10 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL)
-{
+ {
HERROR(H5E_tools_g, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
HGOTO_DONE(dimension_break);
-}
+ }
if(H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, nblocks, ptdata) < 0)
HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed");
@@ -779,20 +779,20 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
* hssize_t npoints is the number of points in the region
*-------------------------------------------------------------------------
*/
-int
+static int
h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx,
h5tools_str_t *buffer, size_t ncols,
- int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
+ unsigned ndims, hid_t type_id, hsize_t npoints, hsize_t *ptdata)
{
hbool_t dimension_break = TRUE;
hsize_t *dims1 = NULL;
hsize_t elmtno; /* elemnt index */
hsize_t curr_pos = 0;
hsize_t total_size[H5S_MAX_RANK];
- size_t jndx;
+ hsize_t jndx;
unsigned indx;
- int type_size;
+ size_t type_size;
int ret_value = SUCCEED;
unsigned int region_flags; /* buffer extent flags */
hid_t mem_space = -1;
@@ -807,7 +807,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
HDmemset(&ctx, 0, sizeof(ctx));
/* Allocate space for the dimension array */
- if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)) == NULL)
+ if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims");
dims1[0] = npoints;
@@ -841,7 +841,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
/* assume entire data space to be printed */
- for (indx = 0; indx < (size_t) ctx.ndims; indx++)
+ for (indx = 0; indx < ctx.ndims; indx++)
ctx.p_min_idx[indx] = 0;
init_acc_pos(&ctx, total_size);
@@ -850,13 +850,12 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
if (jndx == npoints - 1)
region_flags |= END_OF_DATA;
- for (indx = 0; indx < (size_t)ctx.ndims; indx++)
+ for (indx = 0; indx < ctx.ndims; indx++)
ctx.p_max_idx[indx] = cur_ctx->p_max_idx[indx];
ctx.sm_pos = jndx * ndims;
- if (ctx.ndims > 0) {
- ctx.size_last_dim = (int) (ctx.p_max_idx[ctx.ndims - 1]);
- }
+ if (ctx.ndims > 0)
+ ctx.size_last_dim = ctx.p_max_idx[ctx.ndims - 1];
else
ctx.size_last_dim = 0;
@@ -922,11 +921,13 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
hsize_t elmt_counter) {
HERR_INIT(hbool_t, TRUE)
hbool_t dimension_break = TRUE;
- hssize_t npoints;
+ hssize_t snpoints;
+ hsize_t npoints;
hsize_t alloc_size;
hsize_t *ptdata;
- int ndims;
- hssize_t indx;
+ int sndims;
+ unsigned ndims;
+ hsize_t indx;
hid_t dtype = -1;
hid_t type_id = -1;
@@ -934,12 +935,14 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
HDassert(ctx);
HDassert(buffer);
- if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0)
+ if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed");
+ npoints = (hsize_t)snpoints;
/* Allocate space for the dimension array */
- if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0)
+ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ ndims = (unsigned)sndims;
/* Render the region { element begin */
h5tools_str_reset(buffer);
@@ -960,12 +963,11 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size)))
HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
- H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t);
- if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0)
+ if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, npoints, ptdata) < 0)
HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_pointlist failed");
for (indx = 0; indx < npoints; indx++) {
- int loop_indx;
+ unsigned loop_indx;
h5tools_str_append(buffer, info->dset_ptformat_pre,
indx ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) indx);
@@ -1249,7 +1251,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf);
if(H5Sclose(sm_space) < 0)
- H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
if(sm_buf)
HDfree(sm_buf);
sm_buf = NULL;
@@ -1333,7 +1335,7 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
}
/* initialize temporary start, count and maximum start */
- for (i = 0; i < (size_t) ctx->ndims; i++) {
+ for (i = 0; i < ctx->ndims; i++) {
temp_start[i] = sset->start.data[i];
temp_count[i] = sset->count.data[i];
temp_block[i] = sset->block.data[i];
@@ -1375,12 +1377,11 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
if (ctx->ndims > 2) {
/* dimension for start */
- current_outer_dim = (ctx->ndims - 2) - 1;
+ current_outer_dim = (int)(ctx->ndims - 2) - 1;
/* set start to original from current_outer_dim up */
- for (i = current_outer_dim + 1; i < ctx->ndims; i++) {
+ for (i = (size_t)(current_outer_dim + 1); i < ctx->ndims; i++)
temp_start[i] = sset->start.data[i];
- }
/* increment start dimension */
do {
@@ -1472,7 +1473,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
CATCH
if(f_space >= 0 && H5Sclose(f_space) < 0)
- H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
return ret_value;
}
@@ -1500,6 +1501,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
hid_t f_space = -1; /* file data space */
hsize_t elmtno; /* counter */
size_t i; /* counter */
+ int sndims; /* rank of dataspace */
int carry; /* counter carry value */
hsize_t zero[8]; /* vector of zeros */
unsigned int flags; /* buffer extent flags */
@@ -1529,11 +1531,13 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
if (f_space == FAIL)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
- ctx->ndims = H5Sget_simple_extent_ndims(f_space);
+ sndims = H5Sget_simple_extent_ndims(f_space);
+ if(sndims < 0)
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed");
+ ctx->ndims = (unsigned)sndims;
- if ((size_t)ctx->ndims > NELMTS(sm_size)) {
+ if ((size_t)ctx->ndims > NELMTS(sm_size))
H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed");
- }
/* Assume entire data space to be printed */
if (ctx->ndims > 0)
@@ -1652,9 +1656,9 @@ CATCH
done:
if(sm_space >= 0 && H5Sclose(sm_space) < 0)
- H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
if(f_space >= 0 && H5Sclose(f_space) < 0)
- H5E_THROW(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
return ret_value;
}
@@ -1675,10 +1679,14 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte
hid_t type, hid_t space, void *mem)
{
HERR_INIT(herr_t, SUCCEED)
+ int sndims; /* rank of dataspace */
unsigned i; /*counters */
hsize_t nelmts; /*total selected elmts */
- ctx->ndims = H5Sget_simple_extent_ndims(space);
+ sndims = H5Sget_simple_extent_ndims(space);
+ if(sndims < 0)
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed");
+ ctx->ndims = (unsigned)sndims;
if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx))
H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed");
@@ -1696,7 +1704,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte
H5_LEAVE(SUCCEED); /* nothing to print */
if (ctx->ndims > 0) {
HDassert(ctx->p_max_idx[ctx->ndims - 1] == (hsize_t) ((int) ctx->p_max_idx[ctx->ndims - 1]));
- ctx->size_last_dim = (int) (ctx->p_max_idx[ctx->ndims - 1]);
+ ctx->size_last_dim = ctx->p_max_idx[ctx->ndims - 1];
} /* end if */
else
ctx->size_last_dim = 0;
@@ -2583,7 +2591,6 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
unsigned i;
unsigned nmembs = 0; /*number of members */
int snmembs;
- int nchars; /*number of output characters */
hid_t super = -1; /*enum base integer type */
hid_t native = -1; /*native integer datatype */
H5T_sign_t sign_type; /*sign of value type */
@@ -2650,12 +2657,14 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
/* Print members */
for (i = 0; i < nmembs; i++) {
+ int nchars; /*number of output characters */
+
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0);
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "\"%s\"", name[i]);
- nchars = HDstrlen(name[i]);
+ nchars = (int)HDstrlen(name[i]);
h5tools_str_append(buffer, "%*s ", MAX(0, 16 - nchars), "");
if (native < 0) {
@@ -2900,7 +2909,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
size_t cd_nelmts; /* filter client number of values */
off_t offset; /* offset of external file */
char f_name[256]; /* filter name */
- char name[256]; /* external file name */
+ char name[256]; /* external or virtual file name */
hsize_t chsize[64]; /* chunk size in elements */
hsize_t size; /* size of external file */
hsize_t storage_size;
@@ -2942,7 +2951,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
for(i = 1; i < rank; i++)
h5tools_str_append(&buffer, ", " HSIZE_T_FORMAT, chsize[i]);
h5tools_str_append(&buffer, " %s", h5tools_dump_header_format->dataspacedimend);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
@@ -2995,8 +3004,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
else {
h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size);
}
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
-
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
ctx->indent_level--;
break;
case H5D_COMPACT:
@@ -3006,15 +3014,14 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s", COMPACT);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
-
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
ctx->indent_level--;
break;
case H5D_CONTIGUOUS:
@@ -3034,14 +3041,14 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s", CONTIGUOUS);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s %s", EXTERNAL, BEGIN);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
ctx->indent_level++;
for (j = 0; j < (unsigned) next; j++) {
@@ -3053,7 +3060,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "FILENAME %s SIZE " HSIZE_T_FORMAT, name, size);
h5tools_str_append(&buffer, " OFFSET %ld", offset);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
}
ctx->indent_level--;
@@ -3072,14 +3079,14 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "%s", CONTIGUOUS);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer,"SIZE " HSIZE_T_FORMAT, storage_size);
- h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t) ncols, (hsize_t) 0, (hsize_t) 0);
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, curr_pos, 0);
@@ -3437,7 +3444,7 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info,
if (cmt_bufsize > 0) {
comment = (char *)HDmalloc((size_t)(cmt_bufsize+1)); /* new_size including null terminator */
if(comment) {
- cmt_bufsize = H5Oget_comment(obj_id, comment, cmt_bufsize);
+ cmt_bufsize = H5Oget_comment(obj_id, comment, (size_t)cmt_bufsize);
if(cmt_bufsize > 0) {
comment[cmt_bufsize] = '\0'; /* necessary because null char is not returned */
@@ -3576,49 +3583,39 @@ h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims)
void
h5tools_print_packed_bits(h5tools_str_t *buffer, hid_t type)
{
- int packed_bits_size = 0;
-
+ unsigned packed_bits_size = 0;
hid_t n_type = h5tools_get_native_type(type);
- if(H5Tget_class(n_type)==H5T_INTEGER) {
- if(H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE) {
+
+ if(H5Tget_class(n_type) == H5T_INTEGER) {
+ if(H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE)
packed_bits_size = 8 * sizeof(char);
- }
- else if(H5Tequal(n_type, H5T_NATIVE_UCHAR) == TRUE) {
+ else if(H5Tequal(n_type, H5T_NATIVE_UCHAR) == TRUE)
packed_bits_size = 8 * sizeof(unsigned char);
- }
- else if(H5Tequal(n_type, H5T_NATIVE_SHORT) == TRUE) {
+ else if(H5Tequal(n_type, H5T_NATIVE_SHORT) == TRUE)
packed_bits_size = 8 * sizeof(short);
- }
- else if(H5Tequal(n_type, H5T_NATIVE_USHORT) == TRUE) {
+ else if(H5Tequal(n_type, H5T_NATIVE_USHORT) == TRUE)
packed_bits_size = 8 * sizeof(unsigned short);
- }
- else if(H5Tequal(n_type, H5T_NATIVE_INT) == TRUE) {
+ else if(H5Tequal(n_type, H5T_NATIVE_INT) == TRUE)
packed_bits_size = 8 * sizeof(int);
- }
- else if(H5Tequal(n_type, H5T_NATIVE_UINT) == TRUE) {
+ else if(H5Tequal(n_type, H5T_NATIVE_UINT) == TRUE)
packed_bits_size = 8 * sizeof(unsigned int);
- }
- else if(H5Tequal(n_type, H5T_NATIVE_LONG) == TRUE) {
+ else if(H5Tequal(n_type, H5T_NATIVE_LONG) == TRUE)
packed_bits_size = 8 * sizeof(long);
- }
- else if(H5Tequal(n_type, H5T_NATIVE_ULONG) == TRUE) {
+ else if(H5Tequal(n_type, H5T_NATIVE_ULONG) == TRUE)
packed_bits_size = 8 * sizeof(unsigned long);
- }
- else if(H5Tequal(n_type, H5T_NATIVE_LLONG) == TRUE) {
+ else if(H5Tequal(n_type, H5T_NATIVE_LLONG) == TRUE)
packed_bits_size = 8 * sizeof(long long);
- }
- else if(H5Tequal(n_type, H5T_NATIVE_ULLONG) == TRUE) {
+ else if(H5Tequal(n_type, H5T_NATIVE_ULLONG) == TRUE)
packed_bits_size = 8 * sizeof(unsigned long long);
- }
else
error_msg("Packed Bit not valid for this datatype");
}
- if ((packed_bits_size>0) && (packed_data_offset + packed_data_length) > packed_bits_size) {
- error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", packed_data_offset+packed_data_length, packed_bits_size);
+ if((packed_bits_size > 0) && (packed_data_offset + packed_data_length) > packed_bits_size) {
+ error_msg("Packed Bit offset+length value(%u) too large. Max is %d\n", packed_data_offset + packed_data_length, packed_bits_size);
packed_data_mask = 0;
};
- h5tools_str_append(buffer, "%s %s=%d %s=%d", PACKED_BITS, PACKED_OFFSET, packed_data_offset, PACKED_LENGTH, packed_data_length);
+ h5tools_str_append(buffer, "%s %s=%u %s=%u", PACKED_BITS, PACKED_OFFSET, packed_data_offset, PACKED_LENGTH, packed_data_length);
}
/*-------------------------------------------------------------------------
diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h
index ae549fd..749157e 100644
--- a/tools/lib/h5tools_error.h
+++ b/tools/lib/h5tools_error.h
@@ -98,7 +98,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g;
* to the `catch_except' label, if we're not already past it.
*/
#define H5E_THROW(fail_value, min_id, str) { \
- HERROR(H5E_tools_g, min_id, str); \
+ H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, str); \
H5_LEAVE(fail_value) \
}
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index ccdba26..0b42124 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -13,7 +13,7 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "hdf5.h"
+#include "H5private.h"
#include "h5tools.h"
/*-------------------------------------------------------------------------
@@ -151,54 +151,60 @@ int h5tools_can_encode(H5Z_filter_t filtn) {
switch (filtn) {
/* user defined filter */
default:
- return 0;
+ return 0;
case H5Z_FILTER_DEFLATE:
#ifndef H5_HAVE_FILTER_DEFLATE
- return 0;
+ return 0;
#endif
- break;
+ break;
+
case H5Z_FILTER_SZIP:
#ifndef H5_HAVE_FILTER_SZIP
- return 0;
+ return 0;
#else
{
- unsigned int filter_config_flags;
+ unsigned int filter_config_flags;
- if (H5Zget_filter_info(filtn, &filter_config_flags) < 0)
- return -1;
- if ((filter_config_flags
- & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
- /* filter present but neither encode nor decode is supported (???) */
- return -1;
- }
- else if ((filter_config_flags
- & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) {
- /* decoder only: read but not write */
- return 0;
- }
- else if ((filter_config_flags
- & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
- /* encoder only: write but not read (???) */
- return -1;
- }
- else if ((filter_config_flags
- & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED))
- == (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
- return 1;
- }
+ if (H5Zget_filter_info(filtn, &filter_config_flags) < 0)
+ return -1;
+ if ((filter_config_flags
+ & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) {
+ /* filter present but neither encode nor decode is supported (???) */
+ return -1;
+ }
+ else if ((filter_config_flags
+ & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) {
+ /* decoder only: read but not write */
+ return 0;
+ }
+ else if ((filter_config_flags
+ & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) {
+ /* encoder only: write but not read (???) */
+ return -1;
+ }
+ else if ((filter_config_flags
+ & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED))
+ == (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) {
+ return 1;
+ }
}
#endif
- break;
+ break;
+
case H5Z_FILTER_SHUFFLE:
- break;
+ break;
+
case H5Z_FILTER_FLETCHER32:
- break;
+ break;
+
case H5Z_FILTER_NBIT:
- break;
+ break;
+
case H5Z_FILTER_SCALEOFFSET:
- break;
- }/*switch*/
+ break;
+ }/*switch*/
- return 1;
+ return 1;
}
+
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index 3a4183b..8c869c8 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -39,7 +39,7 @@
typedef struct {
haddr_t objno; /* Object ID (i.e. address) */
- const char *path; /* Object path */
+ char *path; /* Object path */
} ref_path_node_t;
static H5SL_t *ref_path_table = NULL; /* the "table" (implemented with a skip list) */
@@ -65,7 +65,7 @@ free_ref_path_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op
{
ref_path_node_t *node = (ref_path_node_t *)item;
- HDfree((void *)node->path);
+ HDfree(node->path);
HDfree(node);
return(0);
@@ -218,7 +218,7 @@ ref_path_table_put(const char *path, haddr_t objno)
HDassert(ref_path_table);
HDassert(path);
- if((new_node = HDmalloc(sizeof(ref_path_node_t))) == NULL)
+ if((new_node = (ref_path_node_t *)HDmalloc(sizeof(ref_path_node_t))) == NULL)
return(-1);
new_node->objno = objno;
@@ -300,7 +300,7 @@ lookup_ref_path(haddr_t ref)
if(ref_path_table == NULL)
init_ref_path_table();
- node = H5SL_search(ref_path_table, &ref);
+ node = (ref_path_node_t *)H5SL_search(ref_path_table, &ref);
return(node ? node->path : NULL);
}
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index a92568a..60b85d9 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -126,14 +126,12 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
va_list ap;
/* Make sure we have some memory into which to print */
- if (!str->s || str->nalloc <= 0) {
+ if (!str->s || str->nalloc <= 0)
h5tools_str_reset(str);
- }
- if (HDstrlen(fmt) == 0) {
+ if (HDstrlen(fmt) == 0)
/* nothing to print */
return str->s;
- }
/* Format the arguments and append to the value already in `str' */
while (1) {
@@ -156,19 +154,18 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
* to lack of buffer size, so try one more time after realloc more
* buffer size before return NULL.
*/
- if (nchars < 0) {
+ if (nchars < 0)
/* failure, such as bad format */
return NULL;
- }
- if (nchars < 0 || (size_t) nchars >= avail || (0 == nchars && (HDstrcmp(fmt, "%s")))) {
+ if ((size_t) nchars >= avail || (0 == nchars && (HDstrcmp(fmt, "%s")))) {
/* Truncation return value as documented by C99, or zero return value with either of the
* following conditions, each of which indicates that the proper C99 return value probably
* should have been positive when the format string is
* something other than "%s"
* Alocate at least twice as much space and try again.
*/
- size_t newsize = MAX(str->len + nchars + 1, 2 * str->nalloc);
+ size_t newsize = MAX(str->len + (size_t)nchars + 1, 2 * str->nalloc);
HDassert(newsize > str->nalloc); /*overflow*/
str->s = (char*)HDrealloc(str->s, newsize);
HDassert(str->s);
@@ -176,7 +173,7 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
}
else {
/* Success */
- str->len += nchars;
+ str->len += (size_t)nchars;
break;
}
}
@@ -267,6 +264,9 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
{
char _temp[1024], *temp = _temp;
+ HDassert(str);
+ HDassert(fmt);
+
/* If the format string is simply "%s" then don't bother doing anything */
if (!HDstrcmp(fmt, "%s"))
return str->s;
@@ -413,9 +413,9 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
}
/*-------------------------------------------------------------------------
- * Function: h5tools_str_dump_region_blocks
+ * Function: h5tools_str_dump_space_slabs
*
- * Purpose: Prints information about a dataspace region by appending
+ * Purpose: Prints information about a dataspace selection by appending
* the information to the specified string.
*
* Return: none
@@ -426,45 +426,111 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
*-------------------------------------------------------------------------
*/
void
-h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
+h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace,
+ const h5tool_format_t *info, h5tools_context_t *ctx)
+{
+ hsize_t start[H5S_MAX_RANK];
+ hsize_t stride[H5S_MAX_RANK];
+ hsize_t count[H5S_MAX_RANK];
+ hsize_t block[H5S_MAX_RANK];
+ int j;
+ int ndims = H5Sget_simple_extent_ndims(rspace);
+
+ H5Sget_regular_hyperslab(rspace, start, stride, count, block);
+
+ /* Print hyperslab information */
+
+ /* Start coordinates */
+ h5tools_str_append(str, "%s%s ", info->line_indent, START);
+ for (j = 0; j < ndims; j++)
+ h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", start[j]);
+ h5tools_str_append(str, ")");
+ h5tools_str_append(str, "%s", "\n");
+ h5tools_str_indent(str, info, ctx);
+
+ /* Stride coordinates */
+ h5tools_str_append(str, "%s ", STRIDE);
+ for (j = 0; j < ndims; j++)
+ h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", stride[j]);
+ h5tools_str_append(str, ")");
+ h5tools_str_append(str, "%s", "\n");
+ h5tools_str_indent(str, info, ctx);
+
+ /* Count coordinates */
+ h5tools_str_append(str, "%s ", COUNT);
+ for (j = 0; j < ndims; j++) {
+ if(count[j] == H5S_UNLIMITED)
+ h5tools_str_append(str, "%s%s", j ? "," : "(","H5S_UNLIMITED");
+ else
+ h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", count[j]);
+ }
+ h5tools_str_append(str, ")");
+ h5tools_str_append(str, "%s", "\n");
+ h5tools_str_indent(str, info, ctx);
+
+ /* Block coordinates */
+ h5tools_str_append(str, "%s ", BLOCK);
+ for (j = 0; j < ndims; j++) {
+ if(block[j] == H5S_UNLIMITED)
+ h5tools_str_append(str, "%s%s", j ? "," : "(","H5S_UNLIMITED");
+ else
+ h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", block[j]);
+ }
+ h5tools_str_append(str, ")");
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5tools_str_dump_space_blocks
+ *
+ * Purpose: Prints information about a dataspace selection by appending
+ * the information to the specified string.
+ *
+ * Return: none
+ *
+ * In/Out:
+ * h5tools_str_t *str
+ *-------------------------------------------------------------------------
+ */
+void
+h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace,
const h5tool_format_t *info)
{
- hssize_t nblocks;
- hsize_t alloc_size;
- hsize_t *ptdata;
- int ndims = H5Sget_simple_extent_ndims(region);
+ hssize_t snblocks;
/*
- * This function fails if the region does not have blocks.
+ * This function fails if the rspace does not have blocks.
*/
H5E_BEGIN_TRY {
- nblocks = H5Sget_select_hyper_nblocks(region);
+ snblocks = H5Sget_select_hyper_nblocks(rspace);
} H5E_END_TRY;
/* Print block information */
- if (nblocks > 0) {
- int i;
-
+ if (snblocks > 0) {
+ hsize_t nblocks;
+ hsize_t *ptdata;
+ hsize_t alloc_size;
+ unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace);
+ hsize_t u;
+
+ nblocks = (hsize_t)snblocks;
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
- H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t);
- H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata);
+ H5Sget_select_hyper_blocklist(rspace, (hsize_t)0, nblocks, ptdata);
- for (i = 0; i < nblocks; i++) {
- int j;
+ for (u = 0; u < nblocks; u++) {
+ unsigned v;
- h5tools_str_append(str, info->dset_blockformat_pre, i ? "," OPTIONAL_LINE_BREAK " " : "",
- (unsigned long)i);
+ h5tools_str_append(str, info->dset_blockformat_pre, u ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long)u);
/* Start coordinates and opposite corner */
- for (j = 0; j < ndims; j++)
- h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(",
- ptdata[i * 2 * ndims + j]);
+ for (v = 0; v < ndims; v++)
+ h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : "(",
+ ptdata[u * 2 * ndims + v]);
- for (j = 0; j < ndims; j++)
- h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : ")-(",
- ptdata[i * 2 * ndims + j + ndims]);
+ for (v = 0; v < ndims; v++)
+ h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : ")-(",
+ ptdata[u * 2 * ndims + v + ndims]);
h5tools_str_append(str, ")");
}
@@ -474,53 +540,53 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
}
/*-------------------------------------------------------------------------
- * Function: h5tools_str_dump_region_points
+ * Function: h5tools_str_dump_space_points
*
- * Purpose: Prints information about a dataspace region by appending
+ * Purpose: Prints information about a dataspace selection by appending
* the information to the specified string.
*
* Return: none
*
* In/Out:
- * h5tools_context_t *ctx
* h5tools_str_t *str
*-------------------------------------------------------------------------
*/
void
-h5tools_str_dump_region_points(h5tools_str_t *str, hid_t region,
+h5tools_str_dump_space_points(h5tools_str_t *str, hid_t rspace,
const h5tool_format_t *info)
{
- hssize_t npoints;
- hsize_t alloc_size;
- hsize_t *ptdata;
- int ndims = H5Sget_simple_extent_ndims(region);
+ hssize_t snpoints;
/*
- * This function fails if the region does not have points.
+ * This function fails if the rspace does not have points.
*/
H5E_BEGIN_TRY {
- npoints = H5Sget_select_elem_npoints(region);
+ snpoints = H5Sget_select_elem_npoints(rspace);
} H5E_END_TRY;
/* Print point information */
- if (npoints > 0) {
- int i;
-
+ if (snpoints > 0) {
+ hsize_t npoints;
+ hsize_t alloc_size;
+ hsize_t *ptdata;
+ unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace);
+ hsize_t u;
+
+ npoints = (hsize_t)snpoints;
alloc_size = npoints * ndims * sizeof(ptdata[0]);
HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
- H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t);
- H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata);
+ H5Sget_select_elem_pointlist(rspace, (hsize_t)0, npoints, ptdata);
- for (i = 0; i < npoints; i++) {
- int j;
+ for (u = 0; u < npoints; u++) {
+ unsigned v;
- h5tools_str_append(str, info->dset_ptformat_pre, i ? "," OPTIONAL_LINE_BREAK " " : "",
- (unsigned long)i);
+ h5tools_str_append(str, info->dset_ptformat_pre, u ? "," OPTIONAL_LINE_BREAK " " : "",
+ (unsigned long)u);
- for (j = 0; j < ndims; j++)
- h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(",
- (ptdata[i * ndims + j]));
+ for (v = 0; v < ndims; v++)
+ h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : "(",
+ (ptdata[u * ndims + v]));
h5tools_str_append(str, ")");
}
@@ -609,13 +675,12 @@ void
h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info,
h5tools_context_t *ctx)
{
- int i, indentlevel = 0;
+ unsigned u, indentlevel = 0;
/* Write new prefix */
- if (ctx->indent_level >= 0) {
+ if (ctx->indent_level > 0)
indentlevel = ctx->indent_level;
- }
- else {
+ else
/*
* This is because sometimes we don't print out all the header
* info for the data (like the tattr-2.ddl example). If that happens
@@ -623,11 +688,9 @@ h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info,
* just print out the default indent levels.
*/
indentlevel = ctx->default_indent_level;
- }
- for (i = 0; i < indentlevel; i++) {
+ for (u = 0; u < indentlevel; u++)
h5tools_str_append(str, "%s", OPT(info->line_indent, ""));
- }
}
/*-------------------------------------------------------------------------
@@ -686,22 +749,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
unsigned char *ucp_vp = (unsigned char *)vp;
char *cp_vp = (char *)vp;
hid_t memb, obj;
- unsigned nmembs;
static char fmt_llong[8], fmt_ullong[8];
H5T_str_t pad;
H5T_class_t type_class;
- /*
- * some tempvars to store the value before we append it to the string to
- * get rid of the memory alignment problem
- */
- unsigned long long tempullong;
- long long templlong;
- unsigned long tempulong;
- long templong;
- unsigned int tempuint;
- int tempint;
-
/* Build default formats for long long types */
if (!fmt_llong[0]) {
HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH);
@@ -737,7 +788,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
float tempfloat;
HDmemcpy(&tempfloat, vp, sizeof(float));
- h5tools_str_append(str, OPT(info->fmt_float, "%g"), tempfloat);
+ h5tools_str_append(str, OPT(info->fmt_float, "%g"), (double)tempfloat);
}
else if (sizeof(double) == nsize) {
/* if (H5Tequal(type, H5T_NATIVE_DOUBLE)) */
@@ -756,6 +807,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
#endif
}
break;
+
case H5T_STRING:
{
unsigned int i;
@@ -776,12 +828,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
pad = H5Tget_strpad(type);
/* Check for NULL pointer for string */
- if (s == NULL) {
+ if (s == NULL)
h5tools_str_append(str, "NULL");
- }
else {
for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
- int j = 1;
+ unsigned j = 1;
/*
* Count how many times the next character repeats. If the
@@ -798,7 +849,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
* in it's own quote.
*/
if (info->str_repeat > 0 && j > info->str_repeat) {
- if (quote) h5tools_str_append(str, "%c", quote);
+ if (quote)
+ h5tools_str_append(str, "%c", quote);
quote = '\'';
h5tools_str_append(str, "%s%c", i ? " " : "", quote);
@@ -821,10 +873,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
quote = '\0';
i += j - 1;
}
-
}
- if (quote) h5tools_str_append(str, "%c", quote);
+ if (quote)
+ h5tools_str_append(str, "%c", quote);
if (i == 0)
/*empty string*/
@@ -832,64 +884,64 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
} /* end else */
}
break;
+
case H5T_INTEGER:
if (sizeof(char) == nsize) {
- /* if ((H5Tequal(type, H5T_NATIVE_SCHAR) || H5Tequal(type, H5T_NATIVE_UCHAR))) */
- if (info->ascii) {
+ if (info->ascii)
h5tools_print_char(str, info, (char) (*ucp_vp));
- }
else if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(type, H5T_NATIVE_UCHAR)) */
unsigned char tempuchar;
+
HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char));
if (packed_bits_num) {
if (packed_data_offset >= 8 * sizeof(unsigned char))
tempuchar = 0;
else
- tempuchar = (tempuchar >> packed_data_offset) & packed_data_mask;
+ tempuchar = (unsigned char)((unsigned long long)(tempuchar >> packed_data_offset) & packed_data_mask);
}
- h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar);
+ h5tools_str_append(str, OPT(info->fmt_uchar, "%hhu"), tempuchar);
}
else {
- /* if (H5Tequal(type, H5T_NATIVE_SCHAR)) */
signed char tempchar;
+
HDmemcpy(&tempchar, cp_vp, sizeof(char));
if (packed_bits_num) {
if (packed_data_offset >= 8 * sizeof(char))
tempchar = 0;
else
- tempchar = (tempchar >> packed_data_offset) & packed_data_mask;
+ tempchar = (signed char)((unsigned long long)(tempchar >> packed_data_offset) & packed_data_mask);
}
h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), tempchar);
}
} /* end if (sizeof(char) == nsize) */
else if (sizeof(int) == nsize) {
if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(type, H5T_NATIVE_UINT)) */
+ unsigned int tempuint;
+
HDmemcpy(&tempuint, vp, sizeof(unsigned int));
if (packed_bits_num) {
if (packed_data_offset >= 8 * sizeof(unsigned int))
tempuint = 0;
else
- tempuint = (tempuint >> packed_data_offset) & packed_data_mask;
+ tempuint = (unsigned)((tempuint >> packed_data_offset) & packed_data_mask);
}
h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint);
}
else {
- /* if (H5Tequal(type, H5T_NATIVE_INT)) */
+ int tempint;
+
HDmemcpy(&tempint, vp, sizeof(int));
if (packed_bits_num) {
if (packed_data_offset >= 8 * sizeof(int))
tempint = 0;
else
- tempint = (tempint >> packed_data_offset) & packed_data_mask;
+ tempint = (int)((unsigned long long)(tempint >> packed_data_offset) & packed_data_mask);
}
h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint);
}
} /* end if (sizeof(int) == nsize) */
else if (sizeof(short) == nsize) {
if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(type, H5T_NATIVE_USHORT)) */
unsigned short tempushort;
HDmemcpy(&tempushort, vp, sizeof(unsigned short));
@@ -897,12 +949,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
if (packed_data_offset >= 8 * sizeof(unsigned short))
tempushort = 0;
else
- tempushort = (tempushort >> packed_data_offset) & packed_data_mask;
+ tempushort = (unsigned short)((unsigned long long)(tempushort >> packed_data_offset) & packed_data_mask);
}
- h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort);
+ h5tools_str_append(str, OPT(info->fmt_ushort, "%hu"), tempushort);
}
else {
- /* if (H5Tequal(type, H5T_NATIVE_SHORT)) */
short tempshort;
HDmemcpy(&tempshort, vp, sizeof(short));
@@ -910,14 +961,15 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
if (packed_data_offset >= 8 * sizeof(short))
tempshort = 0;
else
- tempshort = (tempshort >> packed_data_offset) & packed_data_mask;
+ tempshort = (short)((unsigned long long)(tempshort >> packed_data_offset) & packed_data_mask);
}
- h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort);
+ h5tools_str_append(str, OPT(info->fmt_short, "%hd"), tempshort);
}
} /* end if (sizeof(short) == nsize) */
else if (sizeof(long) == nsize) {
if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(type, H5T_NATIVE_ULONG)) */
+ unsigned long tempulong;
+
HDmemcpy(&tempulong, vp, sizeof(unsigned long));
if (packed_bits_num) {
if (packed_data_offset >= 8 * sizeof(unsigned long))
@@ -928,20 +980,23 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong);
}
else {
- /* if (H5Tequal(type, H5T_NATIVE_LONG)) */
+ long templong;
+
HDmemcpy(&templong, vp, sizeof(long));
if (packed_bits_num) {
if (packed_data_offset >= 8 * sizeof(long))
templong = 0;
else
- templong = (templong >> packed_data_offset) & packed_data_mask;
+ templong = (long)((unsigned long long)(templong >> packed_data_offset) & packed_data_mask);
}
h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong);
}
} /* end if (sizeof(long) == nsize) */
+#if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG
else if (sizeof(long long) == nsize) {
if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(type, H5T_NATIVE_ULLONG)) */
+ unsigned long long tempullong;
+
HDmemcpy(&tempullong, vp, sizeof(unsigned long long));
if (packed_bits_num) {
if (packed_data_offset >= 8 * sizeof(unsigned long long))
@@ -952,7 +1007,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong);
}
else {
- /* if (H5Tequal(type, H5T_NATIVE_LLONG)) */
+ long long templlong;
+
HDmemcpy(&templlong, vp, sizeof(long long));
if (packed_bits_num) {
if (packed_data_offset >= 8 * sizeof(long long))
@@ -963,12 +1019,15 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong);
}
} /* end if (sizeof(long long) == nsize) */
+#endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */
break;
+
case H5T_COMPOUND:
{
+ unsigned nmembs;
unsigned j;
- nmembs = H5Tget_nmembers(type);
+ nmembs = (unsigned)H5Tget_nmembers(type);
h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
ctx->indent_level++;
@@ -979,7 +1038,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
else
h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
- if (info->arr_linebreak) h5tools_str_indent(str, info, ctx);
+ if (info->arr_linebreak)
+ h5tools_str_indent(str, info, ctx);
/* The name */
name = H5Tget_member_name(type, j);
@@ -1001,9 +1061,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_indent(str, info, ctx);
}
h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}"));
-
}
break;
+
case H5T_ENUM:
{
char enum_name[1024];
@@ -1023,10 +1083,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
}
break;
+
case H5T_REFERENCE:
- if (h5tools_str_is_zero(vp, nsize)) {
+ if (h5tools_str_is_zero(vp, nsize))
h5tools_str_append(str, "NULL");
- }
else {
if (nsize == H5R_DSET_REG_REF_BUF_SIZE) {
/* if (H5Tequal(type, H5T_STD_REF_DSETREG)) */
@@ -1082,6 +1142,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
} /* end else if (H5Tequal(type, H5T_STD_REF_OBJ)) */
}
break;
+
case H5T_ARRAY:
{
int k, ndims;
@@ -1108,7 +1169,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
ctx->indent_level++;
for (i = 0; i < nelmts; i++) {
- if (i) h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK));
+ if (i)
+ h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK));
if (info->arr_linebreak && i && i % dims[ndims - 1] == 0) {
h5tools_str_append(str, "%s", "\n");
@@ -1143,6 +1205,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
H5Tclose(memb);
}
break;
+
case H5T_VLEN:
{
unsigned int i;
@@ -1244,9 +1307,9 @@ h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info,
region_type = H5Sget_select_type(region);
if(region_type==H5S_SEL_POINTS)
- h5tools_str_dump_region_points(str, region, info);
+ h5tools_str_dump_space_points(str, region, info);
else
- h5tools_str_dump_region_blocks(str, region, info);
+ h5tools_str_dump_space_blocks(str, region, info);
h5tools_str_append(str, "}");
@@ -1392,31 +1455,33 @@ h5tools_str_is_zero(const void *_mem, size_t size)
char *
h5tools_str_replace ( const char *string, const char *substr, const char *replacement )
{
- char *tok = NULL;
- char *newstr = NULL;
- char *oldstr = NULL;
- char *head = NULL;
-
- if ( substr == NULL || replacement == NULL )
- return HDstrdup (string);
- newstr = HDstrdup (string);
- head = newstr;
- while ( (tok = HDstrstr ( head, substr ))){
- oldstr = newstr;
- newstr = (char *)HDmalloc( HDstrlen( oldstr ) - HDstrlen( substr ) + HDstrlen( replacement ) + 1 );
-
- if ( newstr == NULL ){
- HDfree (oldstr);
- return NULL;
+ char *tok = NULL;
+ char *newstr = NULL;
+ char *head = NULL;
+
+ if(substr == NULL || replacement == NULL)
+ return HDstrdup(string);
+ newstr = HDstrdup(string);
+ head = newstr;
+ while((tok = HDstrstr(head, substr))) {
+ char *oldstr;
+
+ oldstr = newstr;
+ newstr = (char *)HDmalloc(HDstrlen(oldstr) - HDstrlen(substr) + HDstrlen(replacement) + 1);
+
+ if(newstr == NULL) {
+ HDfree(oldstr);
+ return NULL;
}
- HDmemcpy ( newstr, oldstr, tok - oldstr );
- HDmemcpy ( newstr + (tok - oldstr), replacement, HDstrlen ( replacement ) );
- HDmemcpy ( newstr + (tok - oldstr) + HDstrlen( replacement ), tok + HDstrlen ( substr ), HDstrlen ( oldstr ) - HDstrlen ( substr ) - ( tok - oldstr ) );
- HDmemset ( newstr + HDstrlen ( oldstr ) - HDstrlen ( substr ) + HDstrlen ( replacement ) , 0, 1 );
+ HDmemcpy(newstr, oldstr, (size_t)(tok - oldstr));
+ HDmemcpy(newstr + (tok - oldstr), replacement, HDstrlen(replacement));
+ HDmemcpy(newstr + (tok - oldstr) + HDstrlen(replacement), tok + HDstrlen(substr), HDstrlen(oldstr) - HDstrlen(substr) - (size_t)(tok - oldstr));
+ HDmemset(newstr + HDstrlen (oldstr) - HDstrlen(substr) + HDstrlen(replacement) , 0, 1);
/* move back head right after the last replacement */
- head = newstr + (tok - oldstr) + HDstrlen( replacement );
- HDfree (oldstr);
+ head = newstr + (tok - oldstr) + HDstrlen(replacement);
+ HDfree(oldstr);
}
return newstr;
}
+
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index 38697c6..6173b89 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -40,8 +40,9 @@ H5TOOLS_DLL char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_
H5TOOLS_DLL char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
hsize_t elmtno, hsize_t *ptdata, unsigned ndims,
hsize_t max_idx[], h5tools_context_t *ctx);
-H5TOOLS_DLL void h5tools_str_dump_region_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
-H5TOOLS_DLL void h5tools_str_dump_region_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
+H5TOOLS_DLL void h5tools_str_dump_space_slabs(h5tools_str_t *, hid_t, const h5tool_format_t *, h5tools_context_t *ctx);
+H5TOOLS_DLL void h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
+H5TOOLS_DLL void h5tools_str_dump_space_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
H5TOOLS_DLL void h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info, hid_t container,
void *vp);
H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info,
diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c
index d68d3c5..8a56d29 100644
--- a/tools/lib/h5tools_type.c
+++ b/tools/lib/h5tools_type.c
@@ -13,6 +13,7 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include "H5private.h"
#include "h5tools.h"
/*-------------------------------------------------------------------------
@@ -75,54 +76,54 @@ h5tools_get_little_endian_type(hid_t tid)
size = H5Tget_size(tid);
sign = H5Tget_sign(tid);
- switch( type_class )
- {
- case H5T_INTEGER:
- {
- if ( size == 1 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I8LE);
- else if ( size == 2 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I16LE);
- else if ( size == 4 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I32LE);
- else if ( size == 8 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I64LE);
- else if ( size == 1 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U8LE);
- else if ( size == 2 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U16LE);
- else if ( size == 4 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U32LE);
- else if ( size == 8 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U64LE);
- }
- break;
-
- case H5T_FLOAT:
- if ( size == 4)
- p_type=H5Tcopy(H5T_IEEE_F32LE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_IEEE_F64LE);
- break;
-
- case H5T_TIME:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_STRING:
- case H5T_COMPOUND:
- case H5T_REFERENCE:
- case H5T_ENUM:
- case H5T_VLEN:
- case H5T_ARRAY:
- break;
-
- default:
- break;
-
- }
-
- return(p_type);
-}
+ switch(type_class) {
+ case H5T_INTEGER:
+ if ( size == 1 && sign == H5T_SGN_2)
+ p_type=H5Tcopy(H5T_STD_I8LE);
+ else if ( size == 2 && sign == H5T_SGN_2)
+ p_type=H5Tcopy(H5T_STD_I16LE);
+ else if ( size == 4 && sign == H5T_SGN_2)
+ p_type=H5Tcopy(H5T_STD_I32LE);
+ else if ( size == 8 && sign == H5T_SGN_2)
+ p_type=H5Tcopy(H5T_STD_I64LE);
+ else if ( size == 1 && sign == H5T_SGN_NONE)
+ p_type=H5Tcopy(H5T_STD_U8LE);
+ else if ( size == 2 && sign == H5T_SGN_NONE)
+ p_type=H5Tcopy(H5T_STD_U16LE);
+ else if ( size == 4 && sign == H5T_SGN_NONE)
+ p_type=H5Tcopy(H5T_STD_U32LE);
+ else if ( size == 8 && sign == H5T_SGN_NONE)
+ p_type=H5Tcopy(H5T_STD_U64LE);
+ break;
+
+ case H5T_FLOAT:
+ if ( size == 4)
+ p_type=H5Tcopy(H5T_IEEE_F32LE);
+ else if ( size == 8)
+ p_type=H5Tcopy(H5T_IEEE_F64LE);
+ break;
+
+ case H5T_TIME:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_STRING:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ break;
+
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
+ HDassert(0);
+ break;
+
+ } /* end switch */
+
+ return p_type;
+} /* end h5tools_get_little_endian_type() */
/*-------------------------------------------------------------------------
@@ -152,53 +153,51 @@ h5tools_get_big_endian_type(hid_t tid)
size = H5Tget_size(tid);
sign = H5Tget_sign(tid);
- switch( type_class )
- {
- case H5T_INTEGER:
- {
- if ( size == 1 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I8BE);
- else if ( size == 2 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I16BE);
- else if ( size == 4 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I32BE);
- else if ( size == 8 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I64BE);
- else if ( size == 1 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U8BE);
- else if ( size == 2 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U16BE);
- else if ( size == 4 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U32BE);
- else if ( size == 8 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U64BE);
- }
- break;
-
- case H5T_FLOAT:
- if ( size == 4)
- p_type=H5Tcopy(H5T_IEEE_F32BE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_IEEE_F64BE);
- break;
-
- case H5T_TIME:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_STRING:
- case H5T_COMPOUND:
- case H5T_REFERENCE:
- case H5T_ENUM:
- case H5T_VLEN:
- case H5T_ARRAY:
- break;
-
- default:
- break;
-
- }
-
-
- return(p_type);
-}
+ switch(type_class) {
+ case H5T_INTEGER:
+ if ( size == 1 && sign == H5T_SGN_2)
+ p_type=H5Tcopy(H5T_STD_I8BE);
+ else if ( size == 2 && sign == H5T_SGN_2)
+ p_type=H5Tcopy(H5T_STD_I16BE);
+ else if ( size == 4 && sign == H5T_SGN_2)
+ p_type=H5Tcopy(H5T_STD_I32BE);
+ else if ( size == 8 && sign == H5T_SGN_2)
+ p_type=H5Tcopy(H5T_STD_I64BE);
+ else if ( size == 1 && sign == H5T_SGN_NONE)
+ p_type=H5Tcopy(H5T_STD_U8BE);
+ else if ( size == 2 && sign == H5T_SGN_NONE)
+ p_type=H5Tcopy(H5T_STD_U16BE);
+ else if ( size == 4 && sign == H5T_SGN_NONE)
+ p_type=H5Tcopy(H5T_STD_U32BE);
+ else if ( size == 8 && sign == H5T_SGN_NONE)
+ p_type=H5Tcopy(H5T_STD_U64BE);
+ break;
+
+ case H5T_FLOAT:
+ if ( size == 4)
+ p_type=H5Tcopy(H5T_IEEE_F32BE);
+ else if ( size == 8)
+ p_type=H5Tcopy(H5T_IEEE_F64BE);
+ break;
+
+ case H5T_TIME:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_STRING:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ break;
+
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ default:
+ HDassert(0);
+ break;
+ } /* end switch */
+
+ return p_type;
+} /* end h5tools_get_big_endian_type() */
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index b87abf6..e19926b 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -34,7 +34,7 @@
#include "h5trav.h"
/* global variables */
-int h5tools_nCols = 80;
+unsigned h5tools_nCols = 80;
/* ``get_option'' variables */
int opt_err = 1; /*get_option prints errors if this is on */
int opt_ind = 1; /*token pointer */
@@ -57,7 +57,7 @@ hsize_t H5TOOLS_BUFSIZE = ( 32 * 1024 * 1024); /* 32 MB */
/* ``parallel_print'' variables */
unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */
char outBuff[OUTBUFF_SIZE];
-int outBuffOffset;
+unsigned outBuffOffset;
FILE* overflow_file = NULL;
/* local functions */
@@ -89,11 +89,11 @@ void parallel_print(const char* format, ...)
HDvprintf(format, ap);
else {
if(overflow_file == NULL) /*no overflow has occurred yet */ {
- bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap);
+ bytes_written = HDvsnprintf(outBuff + outBuffOffset, OUTBUFF_SIZE - outBuffOffset, format, ap);
HDva_end(ap);
HDva_start(ap, format);
- if((bytes_written < 0) || (bytes_written >= (OUTBUFF_SIZE - outBuffOffset))) {
+ if((bytes_written < 0) || ((unsigned)bytes_written >= (OUTBUFF_SIZE - outBuffOffset))) {
/* Terminate the outbuff at the end of the previous output */
outBuff[outBuffOffset] = '\0';
@@ -104,7 +104,7 @@ void parallel_print(const char* format, ...)
bytes_written = HDvfprintf(overflow_file, format, ap);
}
else
- outBuffOffset += bytes_written;
+ outBuffOffset += (unsigned)bytes_written;
}
else
bytes_written = HDvfprintf(overflow_file, format, ap);
@@ -376,7 +376,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
*-------------------------------------------------------------------------
*/
void
-indentation(int x)
+indentation(unsigned x)
{
if (x < h5tools_nCols) {
while (x-- > 0)
@@ -408,7 +408,7 @@ print_version(const char *progname)
{
PRINTSTREAM(rawoutstream, "%s: Version %u.%u.%u%s%s\n",
progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
- ((char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE);
+ ((const char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE);
}
@@ -680,7 +680,7 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
static void
add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
{
- unsigned u;
+ size_t u;
/* See if we need to make table larger */
if(table->nobjs == table->size) {
@@ -912,7 +912,6 @@ int h5tools_getenv_update_hyperslab_bufsize(void)
hyperslab_bufsize_mb = HDstrtol(env_str, (char**)NULL, 10);
if (errno != 0 || hyperslab_bufsize_mb <= 0)
{
-
/* TODO: later when pubilshed
HDfprintf(rawerrorstream,"Error: Invalid environment variable \"H5TOOLS_BUFSIZE\" : %s\n", env_str);
*/
@@ -922,13 +921,14 @@ int h5tools_getenv_update_hyperslab_bufsize(void)
/* convert MB to byte */
- H5TOOLS_BUFSIZE = hyperslab_bufsize_mb * 1024 * 1024;
+ H5TOOLS_BUFSIZE = (hsize_t)hyperslab_bufsize_mb * 1024 * 1024;
H5TOOLS_MALLOCSIZE = MAX(H5TOOLS_BUFSIZE, H5TOOLS_MALLOCSIZE);
}
-
return (1);
+
error:
return (-1);
}
+
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index 3285278..f7ab65b 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -35,7 +35,7 @@ extern "C" {
H5TOOLS_DLLVAR int g_nTasks;
H5TOOLS_DLLVAR unsigned char g_Parallel;
H5TOOLS_DLLVAR char outBuff[];
-H5TOOLS_DLLVAR int outBuffOffset;
+H5TOOLS_DLLVAR unsigned outBuffOffset;
H5TOOLS_DLLVAR FILE * overflow_file;
/* Maximum size used in a call to malloc for a dataset */
@@ -119,10 +119,10 @@ typedef struct find_objs_t {
table_t *dset_table;
} find_objs_t;
-H5TOOLS_DLLVAR int h5tools_nCols; /*max number of columns for outputting */
+H5TOOLS_DLLVAR unsigned h5tools_nCols; /*max number of columns for outputting */
/* Definitions of useful routines */
-H5TOOLS_DLL void indentation(int);
+H5TOOLS_DLL void indentation(unsigned);
H5TOOLS_DLL void print_version(const char *progname);
H5TOOLS_DLL void parallel_print(const char* format, ... );
H5TOOLS_DLL void error_msg(const char *fmt, ...);