summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5copy/h5copy.c18
-rw-r--r--tools/h5diff/h5diff_common.c2
-rw-r--r--tools/h5diff/h5diff_main.c3
-rw-r--r--tools/h5dump/h5dump.c64
-rw-r--r--tools/h5dump/h5dump.h8
-rw-r--r--tools/h5dump/h5dump_ddl.c150
-rw-r--r--tools/h5dump/h5dump_extern.h6
-rw-r--r--tools/h5dump/h5dump_xml.c1054
-rw-r--r--tools/h5dump/h5dumpgentest.c474
-rw-r--r--tools/h5repack/h5repack_copy.c2214
-rw-r--r--tools/h5repack/h5repack_refs.c241
-rw-r--r--tools/h5repack/h5repack_verify.c246
-rw-r--r--tools/lib/h5diff.c3
-rw-r--r--tools/lib/h5diff_array.c3205
-rw-r--r--tools/lib/h5diff_util.c100
-rw-r--r--tools/lib/h5tools.c88
-rw-r--r--tools/lib/h5tools.h18
-rw-r--r--tools/lib/h5tools_dump.c121
-rw-r--r--tools/lib/h5tools_filters.c79
-rw-r--r--tools/lib/h5tools_str.c240
-rw-r--r--tools/lib/h5tools_utils.c30
-rw-r--r--tools/lib/h5tools_utils.h6
-rw-r--r--tools/lib/h5trav.c8
-rw-r--r--tools/lib/io_timer.c2
-rw-r--r--tools/misc/h5repart.c4
25 files changed, 3955 insertions, 4429 deletions
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index 9947168..f3a0d7a 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -90,7 +90,7 @@ leave(int ret)
*-------------------------------------------------------------------------
*/
static void
-usage (const char *prog)
+usage (void)
{
FLUSHSTREAM(rawoutstream);
PRINTVALSTREAM(rawoutstream, "\n");
@@ -253,7 +253,7 @@ main (int argc, const char *argv[])
/* Check for no command line parameters */
if(argc == 1)
{
- usage(h5tools_getprogname());
+ usage();
leave(EXIT_FAILURE);
} /* end if */
@@ -270,14 +270,14 @@ main (int argc, const char *argv[])
/* validate flag */
if (parse_flag(opt_arg,&flag)<0)
{
- usage(h5tools_getprogname());
+ usage();
leave(EXIT_FAILURE);
}
str_flag = HDstrdup(opt_arg);
break;
case 'h':
- usage(h5tools_getprogname());
+ usage();
leave(EXIT_SUCCESS);
break;
@@ -311,7 +311,7 @@ main (int argc, const char *argv[])
break;
default:
- usage(h5tools_getprogname());
+ usage();
leave(EXIT_FAILURE);
}
} /* end of while */
@@ -323,28 +323,28 @@ main (int argc, const char *argv[])
if (fname_src==NULL)
{
error_msg("Input file name missing\n");
- usage(h5tools_getprogname());
+ usage();
leave(EXIT_FAILURE);
}
if (fname_dst==NULL)
{
error_msg("Output file name missing\n");
- usage(h5tools_getprogname());
+ usage();
leave(EXIT_FAILURE);
}
if (oname_src==NULL)
{
error_msg("Source object name missing\n");
- usage(h5tools_getprogname());
+ usage();
leave(EXIT_FAILURE);
}
if (oname_dst==NULL)
{
error_msg("Destination object name missing\n");
- usage(h5tools_getprogname());
+ usage();
leave(EXIT_FAILURE);
}
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c
index a371cc0..8a996d9 100644
--- a/tools/h5diff/h5diff_common.c
+++ b/tools/h5diff/h5diff_common.c
@@ -358,7 +358,7 @@ void parse_command_line(int argc,
*
*-------------------------------------------------------------------------
*/
-static int
+H5_ATTR_PURE static int
check_n_input( const char *str )
{
unsigned i;
diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index a916ec5..7b4bc39 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -136,7 +136,8 @@ int main(int argc, const char *argv[])
*
*-------------------------------------------------------------------------
*/
-void h5diff_exit(int status)
+void
+h5diff_exit(int status)
{
exit(status);
}
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 553db93..3b46912 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -438,7 +438,7 @@ table_list_add(hid_t oid, unsigned long file_no)
*
*-------------------------------------------------------------------------
*/
-ssize_t
+H5_ATTR_PURE ssize_t
table_list_visited(unsigned long file_no)
{
size_t u; /* Local index variable */
@@ -625,9 +625,8 @@ parse_hsize_list(const char *h_list, subset_d *d)
last_digit = 1;
}
- else {
+ else
last_digit = 0;
- }
if (size_count == 0)
/* there aren't any integers to read */
@@ -639,7 +638,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)HDatoll(ptr);
while (HDisdigit(*ptr))
/* scroll to end of integer */
@@ -647,8 +646,6 @@ parse_hsize_list(const char *h_list, subset_d *d)
}
d->data = p_list;
d->len = size_count;
-
- return;
}
/*-------------------------------------------------------------------------
@@ -671,7 +668,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';
@@ -715,14 +712,15 @@ parse_subset_params(char *dset)
*
* 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;
@@ -740,10 +738,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;
}
@@ -761,14 +760,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;
}
@@ -787,8 +787,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;
}
@@ -960,11 +960,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;
@@ -1173,12 +1177,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 **/
@@ -1716,7 +1718,7 @@ 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)
diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h
index 8f86567..8224c02 100644
--- a/tools/h5dump/h5dump.h
+++ b/tools/h5dump/h5dump.h
@@ -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 */
@@ -85,13 +85,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 09751ab..182d570 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,7 +88,7 @@ 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);
@@ -122,7 +122,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
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);
@@ -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;
}
@@ -198,7 +198,7 @@ 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;
@@ -208,7 +208,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;
}
@@ -379,8 +379,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
H5Dclose(obj);
}
else {
- if (dapl_id)
- H5Pclose(dapl_id && dapl_id != H5P_DEFAULT);
+ if (dapl_id != H5P_DEFAULT)
+ H5Pclose(dapl_id);
error_msg("unable to dump dataset \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
@@ -670,7 +670,7 @@ 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;
@@ -680,7 +680,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;
}
@@ -833,7 +833,7 @@ 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;
@@ -843,7 +843,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;
}
@@ -880,9 +880,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);
@@ -968,7 +967,7 @@ 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;
@@ -978,7 +977,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;
}
@@ -1038,20 +1037,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);
}
@@ -1090,7 +1089,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);
@@ -1147,7 +1146,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;
}
@@ -1158,7 +1157,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)
@@ -1331,19 +1330,17 @@ 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;
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;
+ 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]!='\\')))
+ if(op_name[j] == '/' && (j == 0 || (j > 0 && op_name[j - 1] != '\\')))
break;
j--;
}
@@ -1356,23 +1353,25 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a
}
else {
if(HDstrcmp(attr_name, obj_op_name)==0) {
+ size_t u, v, w;
+
/* 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);
+ 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', (size_t)k);
+ HDmemset(obj_name, '\0', w);
if(op_name[0] != '/') {
- HDstrncat(obj_name, buf, (size_t)i + 1);
- if(buf[i-1] != '/')
+ HDstrncat(obj_name, buf, u + 1);
+ if(buf[u - 1] != '/')
HDstrncat(obj_name, "/", (size_t)2);
}
- HDstrncat(obj_name, op_name, (size_t)j + 1);
+ HDstrncat(obj_name, op_name, v + 1);
handle_attributes(oid, obj_name, NULL, 0, NULL);
HDfree(obj_name);
@@ -1387,29 +1386,32 @@ 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;
-
+ 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) {
+ 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);
+ 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 */
}
@@ -1419,19 +1421,18 @@ 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;
+ const char *op_name = handle_data->op_name;
search_len = HDstrlen(op_name);
- if(search_len > 0 && op_name[0] != '/') {
+ if(search_len > 0 && op_name[0] != '/')
k = 2;
- }
else
k = 1;
- search_name = (char *)HDmalloc((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);
@@ -1439,10 +1440,10 @@ lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
else {
if (k == 2) {
HDstrcpy(search_name, "/");
- HDstrncat(search_name, op_name, (size_t)search_len + 1);
+ HDstrncat(search_name, op_name, search_len + 1);
}
else
- HDstrncpy(search_name, op_name, (size_t)search_len + 1);
+ HDstrncpy(search_name, op_name, search_len + 1);
search_name[search_len + k - 1] = '\0';
if(HDstrcmp(path, search_name) == 0) {
@@ -1513,7 +1514,7 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
}
handle_udata.fid = fid;
- handle_udata.op_name = (char*)path_name;
+ 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);
@@ -1574,7 +1575,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;
@@ -1584,7 +1585,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;
}
@@ -1713,9 +1714,8 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
}
}
if((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) {
- if (pe) {
+ if (pe)
handle_links(fid, dset, data, pe, display_name);
- }
return;
} /* end if */
@@ -1731,8 +1731,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
@@ -2142,12 +2141,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/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h
index 262cef1..8fef1b9 100644
--- a/tools/h5dump/h5dump_extern.h
+++ b/tools/h5dump/h5dump_extern.h
@@ -52,7 +52,7 @@ typedef struct h5dump_table_list_t {
extern h5dump_table_list_t table_list;
extern table_t *group_table, *dset_table, *type_table;
-extern int dump_indent; /*how far in to indent the line */
+extern unsigned dump_indent; /*how far in to indent the line */
extern int unamedtype; /* shared datatype with no name */
extern hbool_t hit_elink; /* whether we have traversed an external link */
@@ -89,8 +89,8 @@ extern H5_iter_order_t sort_order; /*sort_order [ascending | descending] */
extern unsigned long long packed_mask[PACKED_BITS_MAX]; /* packed bits are restricted to 8*sizeof(llong) bytes */
/* packed bits display parameters */
-extern int packed_offset[PACKED_BITS_MAX];
-extern int packed_length[PACKED_BITS_MAX];
+extern unsigned packed_offset[PACKED_BITS_MAX];
+extern unsigned packed_length[PACKED_BITS_MAX];
/*
* The global table is set to either ddl_function_table or
diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c
index 5bc43eb..41f3914 100644
--- a/tools/h5dump/h5dump_xml.c
+++ b/tools/h5dump/h5dump_xml.c
@@ -156,7 +156,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
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;
@@ -332,9 +332,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
H5Dclose(obj);
goto done;
}
- else {
+ else
found_obj->displayed = TRUE;
- }
} /* end if */
dump_function_table->dump_dataset_function(obj, name, NULL);
@@ -756,7 +755,7 @@ xml_escape_the_string(const char *str, int slen)
if (slen < 0)
len = HDstrlen(str);
else
- len = slen;
+ len = (size_t)slen;
extra = 0;
@@ -878,7 +877,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
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;
@@ -954,353 +953,370 @@ xml_print_datatype(hid_t type, unsigned in_group)
}
}
else {
-
switch (H5Tget_class(type)) {
- case H5T_INTEGER:
- 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, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
-
- /* <hdf5:IntegerType ByteOrder="bo" Sign="torf" Size="bytes"/> */
- ord = H5Tget_order(type);
- sgn = H5Tget_sign(type);
-
- 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, "<%sIntegerType ByteOrder=\"",xmlnsprefix);
- switch (ord) {
- case H5T_ORDER_LE:
- h5tools_str_append(&buffer, "LE");
- break;
- case H5T_ORDER_BE:
- h5tools_str_append(&buffer, "BE");
- break;
- case H5T_ORDER_VAX:
- case H5T_ORDER_MIXED:
- case H5T_ORDER_NONE:
- case H5T_ORDER_ERROR:
- default:
- h5tools_str_append(&buffer, "ERROR_UNKNOWN");
- break;
- } /* end switch */
-
- h5tools_str_append(&buffer, "\" Sign=\"");
-
- switch (sgn) {
- case H5T_SGN_NONE:
- h5tools_str_append(&buffer, "false");
- break;
- case H5T_SGN_2:
- h5tools_str_append(&buffer, "true");
- break;
- case H5T_SGN_ERROR:
- case H5T_NSGN:
- default:
- h5tools_str_append(&buffer, "ERROR_UNKNOWN");
- break;
- } /* end switch */
-
- h5tools_str_append(&buffer, "\" Size=\"");
- sz = H5Tget_size(type);
- h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
- h5tools_str_append(&buffer, "\" />");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
-
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ case H5T_INTEGER:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- case H5T_FLOAT:
- /* <hdf5:FloatType ByteOrder="bo" Size="bytes"
- SignBitLocation="bytes"
- ExponentBits="eb" ExponentLocation="el"
- MantissaBits="mb" MantissaLocation="ml" /> */
- ord = H5Tget_order(type);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* <hdf5:IntegerType ByteOrder="bo" Sign="torf" Size="bytes"/> */
+ ord = H5Tget_order(type);
+ sgn = H5Tget_sign(type);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sIntegerType ByteOrder=\"",xmlnsprefix);
+ switch (ord) {
+ case H5T_ORDER_LE:
+ h5tools_str_append(&buffer, "LE");
+ break;
+ case H5T_ORDER_BE:
+ h5tools_str_append(&buffer, "BE");
+ break;
+ case H5T_ORDER_VAX:
+ case H5T_ORDER_MIXED:
+ case H5T_ORDER_NONE:
+ case H5T_ORDER_ERROR:
+ default:
+ h5tools_str_append(&buffer, "ERROR_UNKNOWN");
+ break;
+ } /* end switch */
+
+ h5tools_str_append(&buffer, "\" Sign=\"");
+
+ switch (sgn) {
+ case H5T_SGN_NONE:
+ h5tools_str_append(&buffer, "false");
+ break;
+ case H5T_SGN_2:
+ h5tools_str_append(&buffer, "true");
+ break;
+ case H5T_SGN_ERROR:
+ case H5T_NSGN:
+ default:
+ h5tools_str_append(&buffer, "ERROR_UNKNOWN");
+ break;
+ } /* end switch */
+
+ h5tools_str_append(&buffer, "\" Size=\"");
+ sz = H5Tget_size(type);
+ h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
+ h5tools_str_append(&buffer, "\" />");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix);
-
- switch (ord) {
- case H5T_ORDER_LE:
- h5tools_str_append(&buffer, "LE");
- break;
- case H5T_ORDER_BE:
- h5tools_str_append(&buffer, "BE");
- break;
- case H5T_ORDER_VAX:
- h5tools_str_append(&buffer, "VAX");
- break;
- case H5T_ORDER_MIXED:
- case H5T_ORDER_NONE:
- case H5T_ORDER_ERROR:
- default:
- h5tools_str_append(&buffer, "ERROR_UNKNOWN");
- } /* end switch */
-
- h5tools_str_append(&buffer, "\" Size=\"");
- sz = H5Tget_size(type);
- h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
- H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize);
- h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos);
- h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos);
- h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ case H5T_FLOAT:
+ /* <hdf5:FloatType ByteOrder="bo" Size="bytes"
+ SignBitLocation="bytes"
+ ExponentBits="eb" ExponentLocation="el"
+ MantissaBits="mb" MantissaLocation="ml" /> */
+ ord = H5Tget_order(type);
- case H5T_TIME:
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- h5tools_str_append(&buffer, "<!-- H5T_TIME: not yet implemented -->");
- ctx.indent_level--;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sFloatType ByteOrder=\"",xmlnsprefix);
+
+ switch (ord) {
+ case H5T_ORDER_LE:
+ h5tools_str_append(&buffer, "LE");
+ break;
+ case H5T_ORDER_BE:
+ h5tools_str_append(&buffer, "BE");
+ break;
+ case H5T_ORDER_VAX:
+ h5tools_str_append(&buffer, "VAX");
+ break;
+ case H5T_ORDER_MIXED:
+ case H5T_ORDER_NONE:
+ case H5T_ORDER_ERROR:
+ default:
+ h5tools_str_append(&buffer, "ERROR_UNKNOWN");
+ } /* end switch */
+
+ h5tools_str_append(&buffer, "\" Size=\"");
+ sz = H5Tget_size(type);
+ h5tools_str_append(&buffer, "%lu", (unsigned long)sz);
+ H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize);
+ h5tools_str_append(&buffer, "\" SignBitLocation=\"%lu\" ", (unsigned long)spos);
+ h5tools_str_append(&buffer, "ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos);
+ h5tools_str_append(&buffer, "MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />", (unsigned long)msize, (unsigned long)mpos);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
- case H5T_STRING:
- /* <hdf5:StringType Cset="cs" StrSize="chars" StrPad="pad" /> */
- size = H5Tget_size(type);
- str_pad = H5Tget_strpad(type);
- cset = H5Tget_cset(type);
- is_vlstr = H5Tis_variable_str(type);
+ case H5T_TIME:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.indent_level++;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sTimeType />",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_str_append(&buffer, "<!-- H5T_TIME: not yet implemented -->");
+ ctx.indent_level--;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sStringType Cset=\"",xmlnsprefix);
- if (cset == H5T_CSET_ASCII) {
- h5tools_str_append(&buffer, "H5T_CSET_ASCII\" ");
- }
- else {
- h5tools_str_append(&buffer, "unknown_cset\" ");
- }
- if(is_vlstr)
- h5tools_str_append(&buffer, "StrSize=\"H5T_VARIABLE\" StrPad=\"");
- else
- h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int) size);
- if (str_pad == H5T_STR_NULLTERM) {
- h5tools_str_append(&buffer, "H5T_STR_NULLTERM\"/>");
- }
- else if (str_pad == H5T_STR_NULLPAD) {
- h5tools_str_append(&buffer, "H5T_STR_NULLPAD\"/>");
- }
- else if (str_pad == H5T_STR_SPACEPAD) {
- h5tools_str_append(&buffer, "H5T_STR_SPACEPAD\"/>");
- }
- else {
- h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>");
- }
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ case H5T_STRING:
+ /* <hdf5:StringType Cset="cs" StrSize="chars" StrPad="pad" /> */
+ size = H5Tget_size(type);
+ str_pad = H5Tget_strpad(type);
+ cset = H5Tget_cset(type);
+ is_vlstr = H5Tis_variable_str(type);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- case H5T_BITFIELD:
- /* <hdf5:BitfieldType ByteOrder="bo" Size="bytes"/> */
- ord = H5Tget_order(type);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.indent_level++;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sStringType Cset=\"",xmlnsprefix);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix);
-
- switch (ord) {
- case H5T_ORDER_LE:
- h5tools_str_append(&buffer, "LE");
- break;
- case H5T_ORDER_BE:
- h5tools_str_append(&buffer, "BE");
- break;
- case H5T_ORDER_VAX:
- case H5T_ORDER_MIXED:
- case H5T_ORDER_NONE:
- case H5T_ORDER_ERROR:
- default:
- h5tools_str_append(&buffer, "ERROR_UNKNOWN");
- } /* end switch */
-
- size = H5Tget_size(type);
- h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
+ if (cset == H5T_CSET_ASCII)
+ h5tools_str_append(&buffer, "H5T_CSET_ASCII\" ");
+ else
+ h5tools_str_append(&buffer, "unknown_cset\" ");
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ if(is_vlstr)
+ h5tools_str_append(&buffer, "StrSize=\"H5T_VARIABLE\" StrPad=\"");
+ else
+ h5tools_str_append(&buffer, "StrSize=\"%d\" StrPad=\"", (int) size);
+
+ if (str_pad == H5T_STR_NULLTERM)
+ h5tools_str_append(&buffer, "H5T_STR_NULLTERM\"/>");
+ else if (str_pad == H5T_STR_NULLPAD)
+ h5tools_str_append(&buffer, "H5T_STR_NULLPAD\"/>");
+ else if (str_pad == H5T_STR_SPACEPAD)
+ h5tools_str_append(&buffer, "H5T_STR_SPACEPAD\"/>");
+ else
+ h5tools_str_append(&buffer, "H5T_STR_ERROR\"/>");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- case H5T_OPAQUE:
- /* <hdf5:OpaqueType Tag="tag" Size="bytes" /> */
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ case H5T_BITFIELD:
+ /* <hdf5:BitfieldType ByteOrder="bo" Size="bytes"/> */
+ ord = H5Tget_order(type);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
- mname = H5Tget_tag(type);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname);
- H5free_memory(mname);
- size = H5Tget_size(type);
- h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sBitfieldType ByteOrder=\"",xmlnsprefix);
+
+ switch (ord) {
+ case H5T_ORDER_LE:
+ h5tools_str_append(&buffer, "LE");
+ break;
+ case H5T_ORDER_BE:
+ h5tools_str_append(&buffer, "BE");
+ break;
+ case H5T_ORDER_VAX:
+ case H5T_ORDER_MIXED:
+ case H5T_ORDER_NONE:
+ case H5T_ORDER_ERROR:
+ default:
+ h5tools_str_append(&buffer, "ERROR_UNKNOWN");
+ } /* end switch */
+
+ size = H5Tget_size(type);
+ h5tools_str_append(&buffer, "\" Size=\"%lu\"/>", (unsigned long)size);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- case H5T_COMPOUND:
- /* recursively describe the components of a compound datatype */
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
- /* type of a dataset */
- nmembers = H5Tget_nmembers(type);
+ case H5T_OPAQUE:
+ /* <hdf5:OpaqueType Tag="tag" Size="bytes" /> */
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ mname = H5Tget_tag(type);
- /* List each member Field of the type */
- /* <hdf5:Field FieldName="name" > */
- /* <hdf5:DataType > */
- ctx.indent_level++;
- dump_indent += COL;
- for (i = 0; i < nmembers; i++) {
- char *t_fname;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- mname = H5Tget_member_name(type, i);
- mtype = H5Tget_member_type(type, i);
- t_fname = xml_escape_the_name(mname);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sOpaqueType Tag=\"%s\" ",xmlnsprefix, mname);
+ H5free_memory(mname);
+ size = H5Tget_size(type);
+ h5tools_str_append(&buffer, "Size=\"%lu\"/>", (unsigned long)size);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
- H5free_memory(mname);
- HDfree(t_fname);
- dump_indent += COL;
- ctx.indent_level++;
+ case H5T_COMPOUND:
+ /* recursively describe the components of a compound datatype */
+
+ /* type of a dataset */
+ nmembers = (unsigned)H5Tget_nmembers(type);
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sCompoundType>",xmlnsprefix);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ /* List each member Field of the type */
+ /* <hdf5:Field FieldName="name" > */
+ /* <hdf5:DataType > */
ctx.indent_level++;
dump_indent += COL;
- xml_print_datatype(mtype,0);
+ for (i = 0; i < nmembers; i++) {
+ char *t_fname;
+
+ mname = H5Tget_member_name(type, i);
+ mtype = H5Tget_member_type(type, i);
+ t_fname = xml_escape_the_name(mname);
+
+ 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, "<%sField FieldName=\"%s\">",xmlnsprefix, t_fname);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ H5free_memory(mname);
+ HDfree(t_fname);
+ dump_indent += COL;
+ ctx.indent_level++;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
+ dump_indent += COL;
+ xml_print_datatype(mtype,0);
+ dump_indent -= COL;
+ ctx.indent_level--;
+
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent -= COL;
+ ctx.indent_level--;
+
+ 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, "</%sField>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
dump_indent -= COL;
ctx.indent_level--;
@@ -1309,248 +1325,227 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
+ h5tools_str_append(&buffer, "</%sCompoundType>",xmlnsprefix);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- dump_indent -= COL;
- ctx.indent_level--;
+ break;
+ case H5T_REFERENCE:
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sField>",xmlnsprefix);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- dump_indent -= COL;
- ctx.indent_level--;
-
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.indent_level++;
+ /* Only Object references supported at this time */
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sCompoundType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- case H5T_REFERENCE:
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level++;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
- /* Only Object references supported at this time */
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sReferenceType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level++;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sReferenceType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ ctx.indent_level--;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sObjectReferenceType />",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sReferenceType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- ctx.indent_level--;
+ case H5T_ENUM:
+ /* <hdf5:EnumType Nelems="ne" > list Name, values of enum */
+ nmembs = H5Tget_nmembers(type);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent += COL;
+ ctx.indent_level++;
- case H5T_ENUM:
- /* <hdf5:EnumType Nelems="ne" > list Name, values of enum */
- nmembs = H5Tget_nmembers(type);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ xml_print_enum(type);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- dump_indent += COL;
- ctx.indent_level++;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sEnumType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent -= COL;
+ ctx.indent_level--;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sEnumType Nelems=\"%d\">",xmlnsprefix, nmembs);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- xml_print_enum(type);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ break;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sEnumType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- dump_indent -= COL;
- ctx.indent_level--;
+ case H5T_VLEN:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ super = H5Tget_super(type);
+ dump_indent += COL;
+ ctx.indent_level++;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sAtomicType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- break;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- case H5T_VLEN:
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent += COL;
+ ctx.indent_level++;
+ xml_print_datatype(super,0);
+ dump_indent -= COL;
+ ctx.indent_level--;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sVLType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- super = H5Tget_super(type);
- dump_indent += COL;
- ctx.indent_level++;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent -= COL;
+ ctx.indent_level--;
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- dump_indent += COL;
- ctx.indent_level++;
- xml_print_datatype(super,0);
- dump_indent -= COL;
- ctx.indent_level--;
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sVLType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ H5Tclose(super);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- dump_indent -= COL;
- ctx.indent_level--;
+ break;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ case H5T_ARRAY:
+ /* Get array base type */
+ super = H5Tget_super(type);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sVLType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- H5Tclose(super);
+ /* Print lead-in */
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sArrayType Ndims=\"",xmlnsprefix);
+ ndims = (unsigned)H5Tget_array_ndims(type);
+ h5tools_str_append(&buffer, "%u\">", ndims);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- case H5T_ARRAY:
- /* Get array base type */
- super = H5Tget_super(type);
+ /* Get array information */
+ H5Tget_array_dims2(type, dims);
- /* Print lead-in */
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ /* list of dimensions */
+ ctx.indent_level++;
+ for (i = 0; i < ndims; i++) {
+ 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, "<%sArrayType Ndims=\"",xmlnsprefix);
- ndims = H5Tget_array_ndims(type);
- h5tools_str_append(&buffer, "%u\">", ndims);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ }
+ ctx.indent_level--;
- /* Get array information */
- H5Tget_array_dims2(type, dims);
+ dump_indent += COL;
+ ctx.indent_level++;
- /* list of dimensions */
- ctx.indent_level++;
- for (i = 0; i < ndims; i++) {
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, "<%sArrayDimension DimSize=\"%u\"/>", xmlnsprefix, (int) dims[i]);
+ h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- }
- ctx.indent_level--;
-
- dump_indent += COL;
- ctx.indent_level++;
-
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
-
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- dump_indent += COL;
- ctx.indent_level++;
- xml_print_datatype(super,0);
- dump_indent -= COL;
- ctx.indent_level--;
+ dump_indent += COL;
+ ctx.indent_level++;
+ xml_print_datatype(super,0);
+ dump_indent -= COL;
+ ctx.indent_level--;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- dump_indent -= COL;
- ctx.indent_level--;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sDataType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ dump_indent -= COL;
+ ctx.indent_level--;
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "</%sArrayType>",xmlnsprefix);
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- /* Close array base type */
- H5Tclose(super);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "</%sArrayType>",xmlnsprefix);
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ /* Close array base type */
+ H5Tclose(super);
+ break;
- case H5T_NO_CLASS:
- case H5T_NCLASSES:
- HDassert(0);
- /* fall through */
- default:
- ctx.need_prefix = TRUE;
- h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ HDassert(0);
+ /* fall through */
+ default:
+ ctx.need_prefix = TRUE;
+ h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
- /* Render the element */
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<!-- unknown datatype -->");
- h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- h5tools_setstatus(EXIT_FAILURE);
- break;
+ /* Render the element */
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "<!-- unknown datatype -->");
+ h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+ h5tools_setstatus(EXIT_FAILURE);
+ break;
}
} /* end else */
@@ -1583,7 +1578,7 @@ xml_dump_datatype(hid_t type)
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;
@@ -1593,7 +1588,7 @@ xml_dump_datatype(hid_t type)
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;
}
@@ -1722,7 +1717,7 @@ xml_dump_dataspace(hid_t space)
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;
@@ -1732,7 +1727,7 @@ xml_dump_dataspace(hid_t space)
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;
}
@@ -1898,7 +1893,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
h5tool_format_t string_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
- ctx.indent_level = dump_indent/COL;
+ ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
/* Print all the values. */
@@ -1912,7 +1907,7 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * 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;
}
@@ -1951,12 +1946,10 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED * sset,
if (obj_data == DATASET_DATA) {
type = H5Dget_type(obj_id);
- if (H5Tget_class(type) == H5T_REFERENCE) {
+ if (H5Tget_class(type) == H5T_REFERENCE)
status = xml_print_refs(obj_id, DATASET_DATA);
- }
- else if (H5Tget_class(type) == H5T_STRING) {
+ else if (H5Tget_class(type) == H5T_STRING)
status = xml_print_strs(obj_id, DATASET_DATA);
- }
else {
h5tools_context_t datactx;
HDmemset(&datactx, 0, sizeof(datactx));
@@ -2096,7 +2089,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
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;
@@ -2106,7 +2099,7 @@ xml_dump_attr(hid_t attr, 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;
}
@@ -2426,7 +2419,7 @@ xml_dump_named_datatype(hid_t type, 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;
@@ -2436,7 +2429,7 @@ xml_dump_named_datatype(hid_t type, 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;
}
@@ -2651,7 +2644,7 @@ xml_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;
@@ -2661,7 +2654,7 @@ xml_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;
}
@@ -3007,14 +3000,13 @@ xml_print_refs(hid_t did, int source)
if ((tsiz = H5Tget_size(type)) == 0)
goto error;
- buf = (char *) HDcalloc((size_t)(ssiz * tsiz), sizeof(char));
+ buf = (char *) HDcalloc((size_t)ssiz, tsiz);
if (buf == NULL)
goto error;
e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
/* need to check result here */
- if (e < 0) {
+ if (e < 0)
goto error;
- }
}
else if (source == ATTRIBUTE_DATA) {
space = H5Aget_space(did);
@@ -3023,15 +3015,13 @@ xml_print_refs(hid_t did, int source)
if ((tsiz = H5Tget_size(type)) == 0)
goto error;
- buf = (char *) HDcalloc((size_t)(ssiz * tsiz), sizeof(char));
- if (buf == NULL) {
+ buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ if (buf == NULL)
goto error;
- }
e = H5Aread(did, H5T_STD_REF_OBJ, buf);
/* need to check the result here */
- if (e < 0) {
+ if (e < 0)
goto error;
- }
}
refbuf = (hobj_ref_t *) buf;
@@ -3040,7 +3030,7 @@ xml_print_refs(hid_t did, int source)
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;
@@ -3050,7 +3040,7 @@ xml_print_refs(hid_t did, int source)
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;
}
@@ -3130,7 +3120,7 @@ xml_print_strs(hid_t did, int source)
hssize_t ssiz = -1;
htri_t is_vlstr = FALSE;
size_t tsiz = 0;
- size_t i;
+ hsize_t i;
size_t str_size = 0;
char *bp = NULL;
char *onestring = NULL;
@@ -3141,20 +3131,16 @@ xml_print_strs(hid_t did, int source)
h5tool_format_t string_dataformat;
hsize_t curr_pos = 0; /* total data element position */
- if (source == DATASET_DATA) {
+ if (source == DATASET_DATA)
type = H5Dget_type(did);
- }
- else if (source == ATTRIBUTE_DATA) {
+ else if (source == ATTRIBUTE_DATA)
type = H5Aget_type(did);
- }
- else {
+ else
/* return an error */
return FAIL;
- }
- if (H5Tget_class(type) != H5T_STRING) {
+ if (H5Tget_class(type) != H5T_STRING)
/* return an error */
goto error;
- }
/* Check if we have VL data in the dataset's datatype */
is_vlstr = H5Tis_variable_str(type);
@@ -3165,14 +3151,13 @@ xml_print_strs(hid_t did, int source)
if((tsiz = H5Tget_size(type)) == 0)
goto error;
- buf = HDmalloc((size_t)(ssiz * tsiz));
+ buf = HDmalloc((size_t)ssiz * tsiz);
if (buf == NULL)
goto error;
e = H5Dread(did, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- if (e < 0) {
+ if (e < 0)
goto error;
- }
}
else if (source == ATTRIBUTE_DATA) {
space = H5Aget_space(did);
@@ -3181,14 +3166,13 @@ xml_print_strs(hid_t did, int source)
if((tsiz = H5Tget_size(type)) == 0)
goto error;
- buf = HDmalloc((size_t)(ssiz * tsiz));
+ buf = HDmalloc((size_t)ssiz * tsiz);
if (buf == NULL)
goto error;
e = H5Aread(did, type, buf);
- if (e < 0) {
+ if (e < 0)
goto error;
- }
}
bp = (char*) buf;
@@ -3199,7 +3183,7 @@ xml_print_strs(hid_t did, int source)
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;
@@ -3209,7 +3193,7 @@ xml_print_strs(hid_t did, int source)
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;
}
@@ -3219,11 +3203,11 @@ xml_print_strs(hid_t did, int source)
string_dataformat.do_escape = display_escape;
outputformat = &string_dataformat;
- for (i = 0; i < ssiz; i++) {
+ for (i = 0; i < (hsize_t)ssiz; i++) {
if (is_vlstr) {
onestring = *(char **) bp;
if (onestring)
- str_size = (size_t) HDstrlen(onestring);
+ str_size = HDstrlen(onestring);
}
else {
HDstrncpy(onestring, bp, tsiz);
@@ -3240,7 +3224,7 @@ xml_print_strs(hid_t did, int source)
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
- char *t_onestring = xml_escape_the_string(onestring, (int) str_size);
+ char *t_onestring = xml_escape_the_string(onestring, (int)str_size);
if (t_onestring) {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
@@ -3315,7 +3299,7 @@ check_filters(hid_t dcpl)
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;
@@ -3325,7 +3309,7 @@ check_filters(hid_t dcpl)
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;
}
@@ -3455,7 +3439,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
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;
@@ -3465,7 +3449,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
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;
}
@@ -3825,7 +3809,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s
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;
t_name = xml_escape_the_name(name);
@@ -3839,7 +3823,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED * s
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;
}
@@ -4419,7 +4403,7 @@ xml_print_enum(hid_t type)
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;
@@ -4429,7 +4413,7 @@ xml_print_enum(hid_t type)
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;
}
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 46386a0..1cdf6cf 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -448,7 +448,7 @@ gent_dataset(void)
for(i = 0; i < 30; i++)
for(j = 0; j < 20; j++)
- dset2[i][j] = 0.0001F * j + i;
+ dset2[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
@@ -543,7 +543,7 @@ gent_attribute(void)
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate2(root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++) d[i] = 0.1F * i;
+ for(i = 0; i < 10; i++) d[i] = 0.1F * (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
H5Sclose(space);
@@ -971,16 +971,16 @@ static void gent_compound_dt(void) { /* test compound data type */
for(i = 0; i < (int)sdim; i++) {
dset1[i].a = i;
dset1[i].b = (float)(i*i);
- dset1[i].c = (float)(1.0F/(i+1));
+ dset1[i].c = (float)(1.0F/(float)(i+1));
dset2[i].a = i;
- dset2[i].b = (float)(i+ i*0.1F);
+ dset2[i].b = (float)((float)i+ (float)i*0.1F);
dset4[i].a = i;
dset4[i].b = (float)(i+3);
dset5[i].a = i;
- dset5[i].b = (float)(i*0.1F);
+ dset5[i].b = (float)((float)i*0.1F);
}
@@ -1156,16 +1156,16 @@ static void gent_compound_dt2(void) { /* test compound data type */
for(i = 0; i < (int)sdim; i++) {
dset1[i].a = i;
dset1[i].b = (float)(i*i);
- dset1[i].c = (float)(1.0F/(i+1));
+ dset1[i].c = (float)(1.0F / (float)(i+ 1));
dset2[i].a = i;
- dset2[i].b = (float)(i+ i*0.1F);
+ dset2[i].b = (float)((float)i + (float)i * 0.1F);
dset4[i].a = i;
- dset4[i].b = (float)(i*1.0F);
+ dset4[i].b = (float)((float)i * 1.0F);
dset5[i].a = i;
- dset5[i].b = (float)(i*1.0F);
+ dset5[i].b = (float)((float)i * 1.0F);
}
fid = H5Fcreate(FILE9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1405,7 +1405,7 @@ static void gent_all(void)
space = H5Screate_simple(1, dims, NULL);
dataset = H5Dcreate2(group, "dset2.1", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; i < 10; i++)
- dset2_1[i] = (float)(i * 0.1F + 1);
+ dset2_1[i] = (float)((float)i * 0.1F + 1);
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1);
H5Sclose(space);
H5Dclose(dataset);
@@ -1416,7 +1416,7 @@ static void gent_all(void)
dataset = H5Dcreate2(group, "dset2.2", H5T_IEEE_F32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; i < 3; i++)
for(j = 0; j < 5; j++)
- dset2_2[i][j] = (float)((i + 1) * j * 0.1F);
+ dset2_2[i][j] = (float)((float)(i + 1) * (float)j * 0.1F);
H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_2);
H5Sclose(space);
H5Dclose(dataset);
@@ -1584,7 +1584,7 @@ gent_many(void)
space2 = H5Screate_simple(1, dims, NULL);
attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; i < 10; i++)
- d[i] = 0.1F * i;
+ d[i] = 0.1F * (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
H5Sclose(space2);
H5Aclose(attr);
@@ -1594,9 +1594,9 @@ gent_many(void)
for(i2 = 0; i2 < 2; i2++) {
for(i1 = 0; i1 < 2; i1++) {
for(i0 = 0; i0 < 2; i0++) {
- dset1[j].a[i3][i2][i1][i0] = i0+j;
- dset1[j].b[i3][i2][i1][i0] = (double)(i0+j);
- dset1[j].c[i3][i2][i1][i0] = (double)(i0+j+sdim);
+ dset1[j].a[i3][i2][i1][i0] = i0 + j;
+ dset1[j].b[i3][i2][i1][i0] = (double)(i0 + j);
+ dset1[j].c[i3][i2][i1][i0] = (double)((hsize_t)i0 + (hsize_t)j + sdim);
}
}
}
@@ -1899,7 +1899,7 @@ static void gent_str2(void)
block[0]=1;
for(i = 0; (hsize_t)i < sdim; i++) {
- start[0] = i;
+ start[0] = (hsize_t)i;
sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i);
H5Tset_size(memtype, HDstrlen(buf)+1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
@@ -1912,7 +1912,7 @@ static void gent_str2(void)
dataset = H5Dcreate2(group, "dset2", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; (hsize_t)i < sdim; i++) {
- start[0] = i;
+ start[0] = (hsize_t)i;
sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i);
H5Tset_size(memtype, HDstrlen(buf)+1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
@@ -1932,7 +1932,7 @@ static void gent_str2(void)
dataset = H5Dcreate2(group, "dset3", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0;(hsize_t) i < sdim; i++) {
- start[0] = i;
+ start[0] = (hsize_t)i;
sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i);
H5Tset_size(memtype, HDstrlen(buf)+1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
@@ -1946,7 +1946,7 @@ static void gent_str2(void)
dataset = H5Dcreate2(group, "dset4", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; (hsize_t)i < sdim; i++) {
- start[0] = i;
+ start[0] = (hsize_t)i;
sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i);
H5Tset_size(memtype, HDstrlen(buf)+1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
@@ -1965,7 +1965,7 @@ static void gent_str2(void)
dataset = H5Dcreate2(group, "dset5", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; (hsize_t)i < sdim; i++) {
- start[0] = i;
+ start[0] = (hsize_t)i;
sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i);
H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
@@ -1979,7 +1979,7 @@ static void gent_str2(void)
dataset = H5Dcreate2(group, "dset6", fxdlenstr, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(i = 0; (hsize_t)i < sdim; i++) {
- start[0] = i;
+ start[0] = (hsize_t)i;
sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i);
H5Tset_size(memtype, HDstrlen(buf) + 1);
H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block);
@@ -2065,7 +2065,7 @@ static void gent_objref(void)
dataset = H5Dcreate2(group, "Dataset1", H5T_STD_U32BE, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(tu32 = (uint32_t *)((void*)wbuf), i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = i * 3;
+ *tu32++ = (uint32_t)(i * 3);
/* Write selection to disk */
H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -2170,7 +2170,7 @@ static void gent_datareg(void)
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8BE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
- *tu8++=i*3;
+ *tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
H5Dwrite(dset2, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
@@ -2279,7 +2279,7 @@ static void gent_attrreg(void)
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8BE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++)
- *tu8++=i*3;
+ *tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
H5Dwrite(dset2, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
@@ -2397,8 +2397,8 @@ static void gent_nestcomp(void)
for(i = 0; i< 10; i++) {
s1[i].a = i;
s1[i].b = (float)(i*i);
- s1[i].c = 1.0F/(i+1);
- s1[i].d.a = 65 + i;
+ s1[i].c = 1.0F/(float)(i + 1);
+ s1[i].d.a = (char)(65 + i);
s1[i].d.b[0] = -100.0F;
s1[i].d.b[1] = 100.0F;
}
@@ -2469,8 +2469,8 @@ static void gent_opaque(void)
hsize_t dim = 2;
for(x = 0; x < 100; x++){
- test[x][0] = x;
- test[x][1] = 99 - x;
+ test[x][0] = (char)x;
+ test[x][1] = (char)(99 - x);
}
/*
@@ -2570,8 +2570,8 @@ static void gent_vldatatypes(void)
for(i = 0; i < SPACE1_DIM1; i++) {
int j;
- wdata[i].p = HDmalloc((i + 1) * sizeof(int));
- wdata[i].len = i + 1;
+ wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ wdata[i].len = (size_t)(i + 1);
for(j = 0; j < i + 1; j++)
((int *)wdata[i].p)[j] = i * 10 + j;
@@ -2597,12 +2597,12 @@ static void gent_vldatatypes(void)
for(i = 0; i < SPACE1_DIM1; i++) {
int j;
- wdata[i].p = HDmalloc((i + 1) * sizeof(float));
- wdata[i].len = i + 1;
+ wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(float));
+ wdata[i].len = (size_t)(i + 1);
for(j = 0; j < i + 1; j++)
- ((float *)wdata[i].p)[j] = (float)(i * 10 + ((float)j) / 10.0F);
- }
+ ((float *)wdata[i].p)[j] = (float)((float)(i * 10) + ((float)j) / 10.0F);
+ } /* end for */
/* write out the floats in little-endian format */
space = H5Screate_simple(SPACE1_RANK, dims, NULL);
@@ -2719,9 +2719,9 @@ gent_vldatatypes2(void)
static void gent_vldatatypes3(void)
{
typedef struct { /* Struct that the VL sequences are composed of */
- int i;
- float f;
- hvl_t v;
+ int i;
+ float f;
+ hvl_t v;
} s1;
s1 wdata[SPACE1_DIM1]; /* Information to write */
hid_t fid1; /* HDF5 File IDs */
@@ -2734,12 +2734,12 @@ static void gent_vldatatypes3(void)
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].i=i*10;
- wdata[i].f=(float)((i*20)/3.0F);
- wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int));
- wdata[i].v.len=i+1;
- for(j=0; j<(i+1); j++)
- ((unsigned int *)wdata[i].v.p)[j]=i*10+j;
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)((float)(i * 20)/3.0F);
+ wdata[i].v.p = HDmalloc((size_t)(i + 1) * sizeof(unsigned int));
+ wdata[i].v.len = (size_t)(i + 1);
+ for(j = 0; j < (i + 1); j++)
+ ((unsigned int *)wdata[i].v.p)[j] = i * 10 + j;
} /* end for */
/* Create file */
@@ -2789,8 +2789,8 @@ static void gent_vldatatypes3(void)
static void gent_vldatatypes4(void)
{
typedef struct { /* Struct that the VL sequences are composed of */
- int i;
- float f;
+ int i;
+ float f;
} s1;
hvl_t wdata[SPACE1_DIM1]; /* Information to write */
hid_t fid1; /* HDF5 File IDs */
@@ -2803,11 +2803,11 @@ static void gent_vldatatypes4(void)
/* Allocate and initialize VL data to write */
for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=HDmalloc((i+1)*sizeof(s1));
- wdata[i].len=i+1;
- for(j=0; j<(i+1); j++) {
- ((s1 *)wdata[i].p)[j].i=i*10+j;
- ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F);
+ wdata[i].p = HDmalloc((i + 1) * sizeof(s1));
+ wdata[i].len = i + 1;
+ for(j = 0; j < (i + 1); j++) {
+ ((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)((float)(i * 20 + j) / 3.0F);
} /* end for */
} /* end for */
@@ -2872,10 +2872,10 @@ static void gent_vldatatypes5(void)
wdata[i].p=NULL;
} /* end if */
else {
- wdata[i].len=i+5;
- wdata[i].p=HDmalloc(sizeof(unsigned)*(i+5));
- for(j=0; j<i+5; j++)
- ((unsigned *)wdata[i].p)[j]=j*2;
+ wdata[i].len = (size_t)(i + 5);
+ wdata[i].p = HDmalloc(sizeof(unsigned) * (size_t)(i + 5));
+ for(j = 0; j < i + 5; j++)
+ ((unsigned *)wdata[i].p)[j] = (unsigned)(j * 2);
} /* end else */
} /* end for */
@@ -3177,8 +3177,8 @@ static void gent_array4(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].i=i*10+j;
- wdata[i][j].f=(float)(i*2.5F+j);
+ wdata[i][j].i = i * 10 + j;
+ wdata[i][j].f = (float)((float)i * 2.5F + (float)j);
} /* end for */
/* Create file */
@@ -3244,9 +3244,9 @@ static void gent_array5(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].i=i*10+j;
+ wdata[i][j].i = i * 10 + j;
for(k=0; k<ARRAY1_DIM1; k++)
- wdata[i][j].f[k]=(float)(i*10+j*2.5F+k);
+ wdata[i][j].f[k] = (float)((float)i * 10 + (float)j * 2.5F + (float)k);
} /* end for */
/* Create file */
@@ -3314,10 +3314,10 @@ static void gent_array6(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=HDmalloc((i+j+1)*sizeof(unsigned int));
- wdata[i][j].len=i+j+1;
- for(k=0; k<(i+j+1); k++)
- ((unsigned int *)wdata[i][j].p)[k]=i*100+j*10+k;
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int));
+ wdata[i][j].len = (size_t)(i + j + 1);
+ for(k = 0; k < (i + j + 1); k++)
+ ((unsigned int *)wdata[i][j].p)[k] = (unsigned)(i * 100 + j * 10 + k);
} /* end for */
/* Create file */
@@ -3375,11 +3375,11 @@ static void gent_array7(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=HDmalloc((i+j+1)*(sizeof(unsigned int)*ARRAY1_DIM1));
- wdata[i][j].len=i+j+1;
- for(k=0; k<(i+j+1); k++)
- for(l=0; l<ARRAY1_DIM1; l++)
- ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l]=i*1000+j*100+k*10+l;
+ wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * (sizeof(unsigned int) * ARRAY1_DIM1));
+ wdata[i][j].len = (size_t)(i + j + 1);
+ for(k = 0; k < (i + j + 1); k++)
+ for(l = 0; l<ARRAY1_DIM1; l++)
+ ((unsigned int *)wdata[i][j].p)[k * ARRAY1_DIM1 + l] = (unsigned)(i * 1000+j * 100+k * 10 + l);
} /* end for */
/* Create file */
@@ -3437,15 +3437,15 @@ static void gent_array8(void)
herr_t status = -1;
hsize_t sdims[] = {F64_DIM0};
hsize_t tdims[] = {F64_DIM1};
- int wdata[(F64_DIM1) * sizeof(int)]; /* Write buffer */
+ int wdata[F64_DIM1]; /* Write buffer */
unsigned int i;
/*
* Initialize data. i is the element in the dataspace, j and k the
* elements within the array datatype.
*/
- for (i=0; i<F64_DIM1; i++)
- wdata[i] = i;
+ for (i = 0; i < F64_DIM1; i++)
+ wdata[i] = (int)i;
/*
* Create a new file using the default properties.
@@ -3719,7 +3719,7 @@ void gent_multi(void)
sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];
/*printf("memb_name[%d]=%s, memb_map[%d]=%d; ", mt, memb_name[mt], mt, memb_map[mt]);*/
- memb_addr[mt] = MAX(mt - 1,0) * (HADDR_MAX / 10);
+ memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
}
memb_map[H5FD_MEM_DEFAULT] = H5FD_MEM_SUPER;
@@ -4106,8 +4106,8 @@ static void write_attr_in(hid_t loc_id,
for(j = 0; j < 2; j++) {
int l;
- buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
- buf52[i][j].len = i + 1;
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].len = (size_t)(i + 1);
for(l = 0; l < i + 1; l++)
((int *)buf52[i][j].p)[l] = n++;
}
@@ -4163,7 +4163,7 @@ static void write_attr_in(hid_t loc_id,
for(i = 0; i < 4; i++) {
for(j = 0; j < 3; j++) {
for(k = 0; k < 2; k++) {
- buf23[i][j][k]=n++;
+ buf23[i][j][k] = (char)n++;
}
}
}
@@ -4189,7 +4189,7 @@ static void write_attr_in(hid_t loc_id,
for(i = 0; i < 4; i++) {
for(j = 0; j < 3; j++) {
for(k = 0; k < 2; k++) {
- buf33[i][j][k].a=n++;
+ buf33[i][j][k].a = (char)n++;
buf33[i][j][k].b=n++;
}
}
@@ -4238,8 +4238,8 @@ static void write_attr_in(hid_t loc_id,
for(k = 0; k < 2; k++) {
int l;
- buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
- buf53[i][j][k].len = i + 1;
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
for(l = 0; l < i + 1; l++)
((int *)buf53[i][j][k].p)[l] = n++;
}
@@ -4548,8 +4548,8 @@ static void write_dset_in(hid_t loc_id,
for(j = 0; j < 2; j++) {
int l;
- buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
- buf52[i][j].len = i + 1;
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].len = (size_t)(i + 1);
for(l = 0; l < i + 1; l++)
((int *)buf52[i][j].p)[l] = n++;
}
@@ -4614,13 +4614,10 @@ static void write_dset_in(hid_t loc_id,
*/
n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
- for(k = 0; k < 2; k++) {
- buf23[i][j][k]=n++;
- }
- }
- }
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < 3; j++)
+ for(k = 0; k < 2; k++)
+ buf23[i][j][k] = (char)n++;
tid = H5Tcopy(H5T_STD_B8LE);
write_dset(loc_id,3,dims3,"bitfield3D",tid,buf23);
status = H5Tclose(tid);
@@ -4640,14 +4637,12 @@ static void write_dset_in(hid_t loc_id,
*/
n=1;
- for(i = 0; i < 4; i++) {
- for(j = 0; j < 3; j++) {
+ for(i = 0; i < 4; i++)
+ for(j = 0; j < 3; j++)
for(k = 0; k < 2; k++) {
- buf33[i][j][k].a=n++;
- buf33[i][j][k].b=n++;
+ buf33[i][j][k].a = (char)n++;
+ buf33[i][j][k].b = n++;
}
- }
- }
tid = H5Tcreate (H5T_COMPOUND, sizeof(s_t));
H5Tinsert(tid, "a", HOFFSET(s_t, a), H5T_NATIVE_CHAR);
H5Tinsert(tid, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE);
@@ -4692,8 +4687,8 @@ static void write_dset_in(hid_t loc_id,
for(k = 0; k < 2; k++) {
int l;
- buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
- buf53[i][j][k].len = i + 1;
+ buf53[i][j][k].p = HDmalloc(((size_t)i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
for(l = 0; l < i + 1; l++)
((int *)buf53[i][j][k].p)[l] = n++;
}
@@ -4938,25 +4933,20 @@ static void gent_compound_complex(void)
for(m = 0; m< F41_LENGTH; m++) {
Array1[m].a = m;
- for(n = 0; n < F41_DIMb; n++) {
+ for(n = 0; n < F41_DIMb; n++)
Array1[m].b[n] = quote[n];
- }
- for(n = 0; n < F41_ARRAY_DIMc; n++) {
+ for(n = 0; n < F41_ARRAY_DIMc; n++)
Array1[m].c[n] = chararray[n];
- }
- for(n = 0; n < F41_ARRAY_DIMd1; n++) {
- for(o = 0; o < F41_ARRAY_DIMd2; o++){
- Array1[m].d[n][o] = m + n + o;
- }
- }
+ for(n = 0; n < F41_ARRAY_DIMd1; n++)
+ for(o = 0; o < F41_ARRAY_DIMd2; o++)
+ Array1[m].d[n][o] = (short)(m + n + o);
- Array1[m].e = (float)( m * 0.96F );
+ Array1[m].e = (float)((float)m * 0.96F );
- for(n = 0; n < F41_ARRAY_DIMf; n++) {
- Array1[m].f[n] = ( m * 1024.9637F );
- }
+ for(n = 0; n < F41_ARRAY_DIMf; n++)
+ Array1[m].f[n] = ((float)m * 1024.9637F );
Array1[m].g = 'm';
}
@@ -7154,8 +7144,8 @@ gent_packedbits(void)
for(i = 0; i < dims[0]; i++){
dsetu8[i][0] = valu8bits;
for(j = 1; j < dims[1]; j++)
- dsetu8[i][j] = dsetu8[i][j-1] << 1;
- valu8bits <<= 1;
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j - 1] << 1);
+ valu8bits = (uint8_t)(valu8bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
@@ -7171,8 +7161,8 @@ gent_packedbits(void)
for(i = 0; i < dims[0]; i++){
dsetu16[i][0] = valu16bits;
for(j = 1; j < dims[1]; j++)
- dsetu16[i][j] = dsetu16[i][j-1] << 1;
- valu16bits <<= 1;
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
+ valu16bits = (uint16_t)(valu16bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
@@ -7222,8 +7212,8 @@ gent_packedbits(void)
for(i = 0; i < dims[0]; i++){
dset8[i][0] = val8bits;
for(j = 1; j < dims[1]; j++)
- dset8[i][j] = dset8[i][j-1] << 1;
- val8bits <<= 1;
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
+ val8bits = (int8_t)(val8bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
@@ -7239,8 +7229,8 @@ gent_packedbits(void)
for(i = 0; i < dims[0]; i++){
dset16[i][0] = val16bits;
for(j = 1; j < dims[1]; j++)
- dset16[i][j] = dset16[i][j-1] << 1;
- val16bits <<= 1;
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
+ val16bits = (int16_t)(val16bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
@@ -7288,7 +7278,7 @@ gent_packedbits(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001F * j + i;
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
@@ -7336,9 +7326,9 @@ gent_attr_intsize(void)
for(i = 0; i < dims[0]; i++){
dsetu8[i][0] = valu8bits;
for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = dsetu8[i][j-1] << 1;
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
H5Awrite(attr, H5T_NATIVE_UINT8, dsetu8);
@@ -7354,9 +7344,9 @@ gent_attr_intsize(void)
for(i = 0; i < dims[0]; i++){
dsetu16[i][0] = valu16bits;
for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = dsetu16[i][j-1] << 1;
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
H5Awrite(attr, H5T_NATIVE_UINT16, dsetu16);
@@ -7408,9 +7398,9 @@ gent_attr_intsize(void)
for(i = 0; i < dims[0]; i++){
dset8[i][0] = val8bits;
for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = dset8[i][j-1] << 1;
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
H5Awrite(attr, H5T_NATIVE_INT8, dset8);
@@ -7426,9 +7416,9 @@ gent_attr_intsize(void)
for(i = 0; i < dims[0]; i++){
dset16[i][0] = val16bits;
for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = dset16[i][j-1] << 1;
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
H5Awrite(attr, H5T_NATIVE_INT16, dset16);
@@ -7478,7 +7468,7 @@ gent_attr_intsize(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001F * j + i;
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, dsetdbl);
@@ -7589,33 +7579,33 @@ static void gent_compound_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
valu8bits = (uint8_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu8[n][0] = valu8bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dsetu8[n][o] = Array1[m].dsetu8[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1);
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
/* Array of 16 bits unsigned int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
valu16bits = (uint16_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu16[n][0] = valu16bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dsetu16[n][o] = Array1[m].dsetu16[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1);
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
/* Array of 32 bits unsigned int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
valu32bits = (uint32_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu32[n][0] = valu32bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1;
}
valu32bits <<= 1;
@@ -7625,9 +7615,9 @@ static void gent_compound_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu64[n][0] = valu64bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1;
}
valu64bits <<= 1;
@@ -7637,33 +7627,33 @@ static void gent_compound_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
val8bits = (int8_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset8[n][0] = val8bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dset8[n][o] = Array1[m].dset8[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1);
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
/* Array of 16 bits signed int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
val16bits = (int16_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset16[n][0] = val16bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dset16[n][o] = Array1[m].dset16[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1);
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
/* Array of 32 bits signed int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
val32bits = (int32_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset32[n][0] = val32bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1;
}
val32bits <<= 1;
@@ -7673,9 +7663,9 @@ static void gent_compound_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
val64bits = (int64_t) ~0L; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset64[n][0] = val64bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1;
}
val64bits <<= 1;
@@ -7684,9 +7674,9 @@ static void gent_compound_intsizes(void) {
/* Double Dummy set for failure tests */
dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
- for(n = 0; n < dims[0]; n++)
- for(o = 0; o < dims[1]; o++)
- Array1[m].dsetdbl[n][o] = 0.0001F * o + n;
+ for(n = 0; n < (int)dims[0]; n++)
+ for(o = 0; o < (int)dims[1]; o++)
+ Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n;
}
/* Create the array data type for the 8 bits signed int array */
@@ -7864,33 +7854,33 @@ static void gent_compound_attr_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
valu8bits = (uint8_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu8[n][0] = valu8bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dsetu8[n][o] = Array1[m].dsetu8[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu8[n][o] = (uint8_t)(Array1[m].dsetu8[n][o-1] << 1);
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
/* Array of 16 bits unsigned int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
valu16bits = (uint16_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu16[n][0] = valu16bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dsetu16[n][o] = Array1[m].dsetu16[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dsetu16[n][o] = (uint16_t)(Array1[m].dsetu16[n][o-1] << 1);
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
/* Array of 32 bits unsigned int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
valu32bits = (uint32_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu32[n][0] = valu32bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dsetu32[n][o] = Array1[m].dsetu32[n][o-1] << 1;
}
valu32bits <<= 1;
@@ -7900,9 +7890,9 @@ static void gent_compound_attr_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dsetu64[n][0] = valu64bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dsetu64[n][o] = Array1[m].dsetu64[n][o-1] << 1;
}
valu64bits <<= 1;
@@ -7912,33 +7902,33 @@ static void gent_compound_attr_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
val8bits = (int8_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset8[n][0] = val8bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dset8[n][o] = Array1[m].dset8[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset8[n][o] = (int8_t)(Array1[m].dset8[n][o-1] << 1);
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
/* Array of 16 bits signed int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM16;
val16bits = (int16_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset16[n][0] = val16bits;
- for(o = 1; o < dims[1]; o++) {
- Array1[m].dset16[n][o] = Array1[m].dset16[n][o-1] << 1;
+ for(o = 1; o < (int)dims[1]; o++) {
+ Array1[m].dset16[n][o] = (int16_t)(Array1[m].dset16[n][o-1] << 1);
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
/* Array of 32 bits signed int */
dims[0] = F70_XDIM; dims[1] = F70_YDIM32;
val32bits = (int32_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset32[n][0] = val32bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dset32[n][o] = Array1[m].dset32[n][o-1] << 1;
}
val32bits <<= 1;
@@ -7948,9 +7938,9 @@ static void gent_compound_attr_intsizes(void) {
dims[0] = F70_XDIM; dims[1] = F70_YDIM64;
val64bits = (int64_t) ~0L; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Array1[m].dset64[n][0] = val64bits;
- for(o = 1; o < dims[1]; o++) {
+ for(o = 1; o < (int)dims[1]; o++) {
Array1[m].dset64[n][o] = Array1[m].dset64[n][o-1] << 1;
}
val64bits <<= 1;
@@ -7959,9 +7949,9 @@ static void gent_compound_attr_intsizes(void) {
/* Double Dummy set for failure tests */
dims[0] = F70_XDIM; dims[1] = F70_YDIM8;
- for(n = 0; n < dims[0]; n++)
- for(o = 0; o < dims[1]; o++)
- Array1[m].dsetdbl[n][o] = 0.0001F * o + n;
+ for(n = 0; n < (int)dims[0]; n++)
+ for(o = 0; o < (int)dims[1]; o++)
+ Array1[m].dsetdbl[n][o] = 0.0001F * (float)o + (float)n;
}
/* Create the array data type for the 8 bits signed int array */
@@ -8129,17 +8119,17 @@ static void gent_nested_compound_dt(void) { /* test nested data type */
dset1[i].b = (float)(i*i);
dset2[i].a = i;
- dset2[i].b = (float)(i+i*0.1F);
+ dset2[i].b = (float)((float)i + (float)i * 0.1F);
dset2[i].c = GREEN;
for(j = 0; j < 5; j++) {
- dset3[i].a[j] = i*j;
+ dset3[i].a[j] = i * j;
for(k = 0; k < 6; k++) {
- dset3[i].b[j][k] = (float)(i*j*k*1.0F);
+ dset3[i].b[j][k] = (float)((float)i * (float)j * (float)k * 1.0F);
}
}
dset3[i].c.a = i;
- dset3[i].c.b = (float)(i*1.0F);
+ dset3[i].c.b = (float)((float)i * 1.0F);
}
fid = H5Fcreate(FILE72, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -8277,9 +8267,9 @@ gent_intscalars(void)
for(i = 0; i < dims[0]; i++){
dsetu8[i][0] = valu8bits;
for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = dsetu8[i][j-1] << 1;
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
@@ -8296,9 +8286,9 @@ gent_intscalars(void)
for(i = 0; i < dims[0]; i++){
dsetu16[i][0] = valu16bits;
for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = dsetu16[i][j-1] << 1;
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
@@ -8353,9 +8343,9 @@ gent_intscalars(void)
for(i = 0; i < dims[0]; i++){
dset8[i][0] = val8bits;
for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = dset8[i][j-1] << 1;
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
@@ -8372,9 +8362,9 @@ gent_intscalars(void)
for(i = 0; i < dims[0]; i++){
dset16[i][0] = val16bits;
for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = dset16[i][j-1] << 1;
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
@@ -8427,7 +8417,7 @@ gent_intscalars(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001F * j + i;
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
@@ -8476,9 +8466,9 @@ gent_attr_intscalars(void)
for(i = 0; i < dims[0]; i++){
dsetu8[i][0] = valu8bits;
for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = dsetu8[i][j-1] << 1;
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
H5Awrite(attr, tid, dsetu8);
@@ -8495,9 +8485,9 @@ gent_attr_intscalars(void)
for(i = 0; i < dims[0]; i++){
dsetu16[i][0] = valu16bits;
for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = dsetu16[i][j-1] << 1;
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
H5Awrite(attr, tid, dsetu16);
@@ -8552,9 +8542,9 @@ gent_attr_intscalars(void)
for(i = 0; i < dims[0]; i++){
dset8[i][0] = val8bits;
for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = dset8[i][j-1] << 1;
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
H5Awrite(attr, tid, dset8);
@@ -8571,9 +8561,9 @@ gent_attr_intscalars(void)
for(i = 0; i < dims[0]; i++){
dset16[i][0] = val16bits;
for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = dset16[i][j-1] << 1;
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
H5Awrite(attr, tid, dset16);
@@ -8626,7 +8616,7 @@ gent_attr_intscalars(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001F * j + i;
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Awrite(attr, tid, dsetdbl);
@@ -8665,9 +8655,9 @@ gent_string_scalars(void)
memset(string, ' ', F73_XDIM * F73_YDIM8);
for(i = 0; i < dims[0]; i++) {
- string[i][0] = 'A' + i;
+ string[i][0] = (char)('A' + i);
for(j = 1; j < dims[1]; j++) {
- string[i][j] = string[i][j-1] + 1;
+ string[i][j] = (char)(string[i][j-1] + 1);
}
}
string[dims[0]-1][dims[1]-1] = 0;
@@ -8740,25 +8730,25 @@ static void gent_compound_int_array(void) {
dims[0] = F76_DIM8;
valu8bits = (uint8_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Cmpd1[m].dsetu8[n] = valu8bits;
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
/* Array of 16 bits unsigned int */
dims[0] = F76_DIM16;
valu16bits = (uint16_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Cmpd1[m].dsetu16[n] = valu16bits;
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
/* Array of 32 bits unsigned int */
dims[0] = F76_DIM32;
valu32bits = (uint32_t) ~0u; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Cmpd1[m].dsetu32[n] = valu32bits;
valu32bits <<= 1;
}
@@ -8767,7 +8757,7 @@ static void gent_compound_int_array(void) {
dims[0] = F76_DIM64;
valu64bits = (uint64_t) ~0Lu; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Cmpd1[m].dsetu64[n] = valu64bits;
valu64bits <<= 1;
}
@@ -8776,25 +8766,25 @@ static void gent_compound_int_array(void) {
dims[0] = F76_DIM8;
val8bits = (int8_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Cmpd1[m].dset8[n] = val8bits;
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
/* Array of 16 bits signed int */
dims[0] = F76_DIM16;
val16bits = (int16_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Cmpd1[m].dset16[n] = val16bits;
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
/* Array of 32 bits signed int */
dims[0] = F76_DIM32;
val32bits = (int32_t) ~0; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Cmpd1[m].dset32[n] = val32bits;
val32bits <<= 1;
}
@@ -8803,7 +8793,7 @@ static void gent_compound_int_array(void) {
dims[0] = F76_DIM64;
val64bits = (int64_t) ~0L; /* all 1s */
- for(n = 0; n < dims[0]; n++){
+ for(n = 0; n < (int)dims[0]; n++){
Cmpd1[m].dset64[n] = val64bits;
val64bits <<= 1;
}
@@ -8811,8 +8801,8 @@ static void gent_compound_int_array(void) {
/* Double Dummy set for failure tests */
dims[0] = F76_DIM8;
- for(n = 0; n < dims[0]; n++)
- Cmpd1[m].dsetdbl[n] = 0.0001F + n;
+ for(n = 0; n < (int)dims[0]; n++)
+ Cmpd1[m].dsetdbl[n] = 0.0001F + (float)n;
}
/* Create the array data type for the 8 bits signed int array */
@@ -8991,14 +8981,14 @@ static void gent_compound_ints(void) {
valu8bits = (uint8_t) ~0u; /* all 1s */
Cmpd1[m].dsetu8 = valu8bits;
Cmpd2[m].dsetu8 = valu8bits;
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
/* Array of 16 bits unsigned int */
if((m % F76_DIM16) == 0)
valu16bits = (uint16_t) ~0u; /* all 1s */
Cmpd1[m].dsetu16 = valu16bits;
Cmpd2[m].dsetu16 = valu16bits;
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
/* Array of 32 bits unsigned int */
if((m % F76_DIM32) == 0)
@@ -9019,14 +9009,14 @@ static void gent_compound_ints(void) {
val8bits = (int8_t) ~0; /* all 1s */
Cmpd1[m].dset8 = val8bits;
Cmpd2[m].dset8 = val8bits;
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
/* Array of 16 bits signed int */
if((m % F76_DIM16) == 0)
val16bits = (int16_t) ~0; /* all 1s */
Cmpd1[m].dset16 = val16bits;
Cmpd2[m].dset16 = val16bits;
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
/* Array of 32 bits signed int */
if((m % F76_DIM32) == 0)
@@ -9043,8 +9033,8 @@ static void gent_compound_ints(void) {
val64bits <<= 1;
/* Double Dummy set for failure tests */
- Cmpd1[m].dsetdbl = 0.0001F + m;
- Cmpd2[m].dsetdbl = 0.0001F + m;
+ Cmpd1[m].dsetdbl = 0.0001F + (float)m;
+ Cmpd2[m].dsetdbl = 0.0001F + (float)m;
}
/* Create the dataspace */
@@ -9199,9 +9189,9 @@ gent_intattrscalars(void)
for(i = 0; i < dims[0]; i++){
dsetu8[i][0] = valu8bits;
for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = dsetu8[i][j-1] << 1;
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
@@ -9222,9 +9212,9 @@ gent_intattrscalars(void)
for(i = 0; i < dims[0]; i++){
dsetu16[i][0] = valu16bits;
for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = dsetu16[i][j-1] << 1;
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
@@ -9291,9 +9281,9 @@ gent_intattrscalars(void)
for(i = 0; i < dims[0]; i++){
dset8[i][0] = val8bits;
for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = dset8[i][j-1] << 1;
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
@@ -9314,9 +9304,9 @@ gent_intattrscalars(void)
for(i = 0; i < dims[0]; i++){
dset16[i][0] = val16bits;
for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = dset16[i][j-1] << 1;
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
@@ -9381,7 +9371,7 @@ gent_intattrscalars(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++)
- dsetdbl[i][j] = 0.0001F * j + i;
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl);
/* Attribute of double */
@@ -9433,10 +9423,10 @@ gent_intsattrs(void)
dsetu8[i][0] = valu8bits;
asetu8[i*dims[1]] = dsetu8[i][0];
for(j = 1; j < dims[1]; j++) {
- dsetu8[i][j] = dsetu8[i][j-1] << 1;
+ dsetu8[i][j] = (uint8_t)(dsetu8[i][j-1] << 1);
asetu8[i*dims[1]+j] = dsetu8[i][j];
}
- valu8bits <<= 1;
+ valu8bits = (uint8_t)(valu8bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8);
@@ -9460,10 +9450,10 @@ gent_intsattrs(void)
dsetu16[i][0] = valu16bits;
asetu16[i*dims[1]] = dsetu16[i][0];
for(j = 1; j < dims[1]; j++) {
- dsetu16[i][j] = dsetu16[i][j-1] << 1;
+ dsetu16[i][j] = (uint16_t)(dsetu16[i][j-1] << 1);
asetu16[i*dims[1]+j] = dsetu16[i][j];
}
- valu16bits <<= 1;
+ valu16bits = (uint16_t)(valu16bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16);
@@ -9541,10 +9531,10 @@ gent_intsattrs(void)
dset8[i][0] = val8bits;
aset8[i*dims[1]] = dset8[i][0];
for(j = 1; j < dims[1]; j++) {
- dset8[i][j] = dset8[i][j-1] << 1;
+ dset8[i][j] = (int8_t)(dset8[i][j-1] << 1);
aset8[i*dims[1]+j] = dset8[i][j];
}
- val8bits <<= 1;
+ val8bits = (int8_t)(val8bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8);
@@ -9568,10 +9558,10 @@ gent_intsattrs(void)
dset16[i][0] = val16bits;
aset16[i*dims[1]] = dset16[i][0];
for(j = 1; j < dims[1]; j++) {
- dset16[i][j] = dset16[i][j-1] << 1;
+ dset16[i][j] = (int16_t)(dset16[i][j-1] << 1);
aset16[i*dims[1]+j] = dset16[i][j];
}
- val16bits <<= 1;
+ val16bits = (int16_t)(val16bits << 1);
}
H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16);
@@ -9646,7 +9636,7 @@ gent_intsattrs(void)
for(i = 0; i < dims[0]; i++)
for(j = 0; j < dims[1]; j++) {
- dsetdbl[i][j] = 0.0001F * j + i;
+ dsetdbl[i][j] = 0.0001F * (float)j + (float)i;
asetdbl[i*dims[1]+j] = dsetdbl[i][j];
}
@@ -9823,7 +9813,7 @@ static void gent_bitnopaquefields(void)
static void
gent_intsfourdims(void)
{
- hid_t fid, dataset, space, tid;
+ hid_t fid, dataset, space;
hsize_t dims[F81_RANK];
uint32_t dset1[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM];
unsigned int i, j, k, l;
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 9c01b7e..547f61a 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -36,7 +36,7 @@
#define USERBLOCK_XFER_SIZE 512
/* check H5Dread()/H5Dwrite() error, e.g. memory allocation error inside the library. */
-#define CHECK_H5DRW_ERROR(_fun, _did, _mtid, _msid, _fsid, _pid, _buf) { \
+#define CHECK_H5DRW_ERROR(_fun, _fail, _did, _mtid, _msid, _fsid, _pid, _buf) { \
H5E_BEGIN_TRY { \
if(_fun(_did, _mtid, _msid, _fsid, _pid, _buf) < 0) { \
hid_t _err_num = 0; \
@@ -44,7 +44,7 @@
H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \
H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \
error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \
- goto done; \
+ HGOTO_DONE(_fail) \
} \
} H5E_END_TRY; \
}
@@ -97,170 +97,166 @@ static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t
*-------------------------------------------------------------------------
*/
-int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) {
+int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
+{
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
hid_t fidin;
- hid_t fidout = -1;
- trav_table_t *travt = NULL;
- hsize_t ub_size = 0; /* size of user block */
- hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
- hid_t fapl = H5P_DEFAULT; /* file access property list ID */
-
- /*-------------------------------------------------------------------------
- * open input file
- *-------------------------------------------------------------------------
- */
- if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL,
- (size_t) 0)) < 0) {
- error_msg("<%s>: %s\n", fnamein, H5FOPENERROR);
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ hid_t fidout = -1;
+ trav_table_t *travt = NULL;
+ hsize_t ub_size = 0; /* size of user block */
+ hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
+ hid_t fapl = H5P_DEFAULT; /* file access property list ID */
+
+ /*-------------------------------------------------------------------------
+ * open input file
+ *-------------------------------------------------------------------------
+ */
+ if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0) {
+ error_msg("<%s>: %s\n", fnamein, H5FOPENERROR);
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- /* get user block size and file space strategy/threshold */
- {
- hid_t fcpl_in; /* file creation property list ID for input file */
+ /* get user block size and file space strategy/threshold */
+ {
+ hid_t fcpl_in; /* file creation property list ID for input file */
- if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
- error_msg("failed to retrieve file creation property list\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
+ error_msg("failed to retrieve file creation property list\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- if (H5Pget_userblock(fcpl_in, &ub_size) < 0) {
- error_msg("failed to retrieve userblock size\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Pget_userblock(fcpl_in, &ub_size) < 0) {
+ error_msg("failed to retrieve userblock size\n");
+ 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(H5E_tools_g, 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(H5E_tools_g, 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(H5E_tools_g, 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");
}
- }
+ }
- /* Check if we need to create a non-default file creation property list */
- if (options->latest || ub_size > 0) {
- /* Create file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
- error_msg("fail to create a file creation property list\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ /* Check if we need to create a non-default file creation property list */
+ if (options->latest || ub_size > 0) {
+ /* Create file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
+ error_msg("fail to create a file creation property list\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- if (ub_size > 0) {
- if (H5Pset_userblock(fcpl, ub_size) < 0) {
- error_msg("failed to set non-default userblock size\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ if (ub_size > 0) {
+ if (H5Pset_userblock(fcpl, ub_size) < 0) {
+ error_msg("failed to set non-default userblock size\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- }
+ }
- if (options->latest) {
- unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5];
+ if (options->latest) {
+ unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5];
- /* Adjust group creation parameters for root group */
- /* (So that it is created in "dense storage" form) */
- if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact,
- (unsigned) options->grp_indexed) < 0) {
- error_msg(
- "fail to adjust group creation parameters for root group\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ /* Adjust group creation parameters for root group */
+ /* (So that it is created in "dense storage" form) */
+ if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact,
+ (unsigned) options->grp_indexed) < 0) {
+ error_msg("fail to adjust group creation parameters for root group\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- for (i = 0; i < 5; i++) {
- if (options->msg_size[i] > 0) {
- switch (i) {
- case 0:
- mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG;
- break;
-
- case 1:
- mesg_type_flags[nindex] = H5O_SHMESG_DTYPE_FLAG;
- break;
-
- case 2:
- mesg_type_flags[nindex] = H5O_SHMESG_FILL_FLAG;
- break;
-
- case 3:
- mesg_type_flags[nindex] = H5O_SHMESG_PLINE_FLAG;
- break;
-
- case 4:
- mesg_type_flags[nindex] = H5O_SHMESG_ATTR_FLAG;
- break;
- default:
- break;
- } /* end switch */
- min_mesg_sizes[nindex] = (unsigned) options->msg_size[i];
-
- nindex++;
- } /* end if */
- } /* end for */
-
- if (nindex > 0) {
- if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) {
- error_msg(
- "fail to set the number of shared object header message indexes\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ for (i = 0; i < 5; i++) {
+ if (options->msg_size[i] > 0) {
+ switch (i) {
+ case 0:
+ mesg_type_flags[nindex] = H5O_SHMESG_SDSPACE_FLAG;
+ break;
+
+ case 1:
+ mesg_type_flags[nindex] = H5O_SHMESG_DTYPE_FLAG;
+ break;
+
+ case 2:
+ mesg_type_flags[nindex] = H5O_SHMESG_FILL_FLAG;
+ break;
+
+ case 3:
+ mesg_type_flags[nindex] = H5O_SHMESG_PLINE_FLAG;
+ break;
+
+ case 4:
+ mesg_type_flags[nindex] = H5O_SHMESG_ATTR_FLAG;
+ break;
+
+ default:
+ break;
+ } /* end switch */
+ min_mesg_sizes[nindex] = (unsigned) options->msg_size[i];
+
+ nindex++;
+ } /* end if */
+ } /* end for */
+
+ if (nindex > 0) {
+ if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) {
+ error_msg("fail to set the number of shared object header message indexes\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */
- for (i = 0; i < (nindex - 1); i++) {
- if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i],
- min_mesg_sizes[i]) < 0) {
- error_msg(
- "fail to configure the specified shared object header message index\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */
+ for (i = 0; i < (nindex - 1); i++) {
+ if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) {
+ error_msg("fail to configure the specified shared object header message index\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
} /* end if */
- } /* end for */
- } /* if (nindex>0) */
+ } /* end for */
+ } /* if (nindex>0) */
- /* Create file access property list */
- if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
- error_msg("Could not create file access property list\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ /* Create file access property list */
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ error_msg("Could not create file access property list\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
} /* end if */
- if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
- error_msg(
- "Could not set property for using latest version of the format\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ error_msg("Could not set property for using latest version of the format\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
} /* end if */
- } /* end if */
- } /* end if */
+ } /* end if */
+ } /* end if */
#if defined (H5REPACK_DEBUG_USER_BLOCK)
- print_user_block(fnamein, fidin);
+print_user_block(fnamein, fidin);
#endif
- /*-------------------------------------------------------------------------
- * set the new user userblock options in the FCPL (before H5Fcreate )
- *-------------------------------------------------------------------------
- */
- if (options->ublock_size > 0) {
- /* either use the FCPL already created or create a new one */
- if (fcpl == H5P_DEFAULT) {
- /* create a file creation property list */
- if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
- error_msg("fail to create a file creation property list\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ /*-------------------------------------------------------------------------
+ * set the new user userblock options in the FCPL (before H5Fcreate )
+ *-------------------------------------------------------------------------
+ */
+ if (options->ublock_size > 0) {
+ /* either use the FCPL already created or create a new one */
+ if (fcpl == H5P_DEFAULT) {
+ /* create a file creation property list */
+ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
+ error_msg("fail to create a file creation property list\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- }
+ }
/* set user block size */
if (H5Pset_userblock(fcpl, options->ublock_size) < 0) {
error_msg("failed to set userblock size\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
}
@@ -274,13 +270,13 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
/* create a file access property list */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
error_msg("Could not create file access property list\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
}
if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) {
error_msg("failed to set alignment\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
}
@@ -294,13 +290,13 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
/* create a file access property list */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
error_msg("Could not create file access property list\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
}
if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) {
error_msg("failed to set metadata block size\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
}
@@ -314,14 +310,14 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
/* create a file creation property list */
if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) {
error_msg("fail to create a file creation property list\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
}
/* 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(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
/*-------------------------------------------------------------------------
@@ -333,7 +329,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) {
error_msg("<%s>: Could not create file\n", fnameout);
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
/*-------------------------------------------------------------------------
@@ -341,95 +337,91 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
*-------------------------------------------------------------------------
*/
if (options->ublock_size > 0) {
- if (copy_user_block(options->ublock_filename, fnameout,
- options->ublock_size) < 0) {
+ if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) {
error_msg("Could not copy user block. Exiting...\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
}
- /*-------------------------------------------------------------------------
- * get list of objects
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * get list of objects
+ *-------------------------------------------------------------------------
+ */
- /* init table */
- trav_table_init(&travt);
+ /* init table */
+ trav_table_init(&travt);
- /* get the list of objects in the file */
- if (h5trav_gettable(fidin, travt) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ /* get the list of objects in the file */
+ if (h5trav_gettable(fidin, travt) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
- /*-------------------------------------------------------------------------
- * do the copy
- *-------------------------------------------------------------------------
- */
- if (do_copy_objects(fidin, fidout, travt, options) < 0) {
- error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout);
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ /*-------------------------------------------------------------------------
+ * do the copy
+ *-------------------------------------------------------------------------
+ */
+ if (do_copy_objects(fidin, fidout, travt, options) < 0) {
+ error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout);
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
} /* end if */
- /*-------------------------------------------------------------------------
- * do the copy of referenced objects
- * and create hard links
- *-------------------------------------------------------------------------
- */
- if (do_copy_refobjs(fidin, fidout, travt, options) < 0) {
- printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein,
- fnameout);
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ /*-------------------------------------------------------------------------
+ * do the copy of referenced objects
+ * and create hard links
+ *-------------------------------------------------------------------------
+ */
+ if (do_copy_refobjs(fidin, fidout, travt, options) < 0) {
+ printf("h5repack: <%s>: Could not copy data to: %s\n", fnamein, fnameout);
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
-
- if (fapl > 0)
- H5Pclose(fapl);
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
- if (fcpl > 0)
- H5Pclose(fcpl);
+ if (fapl > 0)
+ H5Pclose(fapl);
- H5Fclose(fidin);
- H5Fclose(fidout);
+ if (fcpl > 0)
+ H5Pclose(fcpl);
- /* free table */
- trav_table_free(travt);
- travt = NULL;
+ H5Fclose(fidin);
+ H5Fclose(fidout);
- /*-------------------------------------------------------------------------
- * write only the input file user block if there is no user block file input
- *-------------------------------------------------------------------------
- */
+ /* free table */
+ trav_table_free(travt);
+ travt = NULL;
- if (ub_size > 0 && options->ublock_size == 0) {
- if (copy_user_block(fnamein, fnameout, ub_size) < 0) {
- error_msg("Could not copy user block. Exiting...\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ /*-------------------------------------------------------------------------
+ * write only the input file user block if there is no user block file input
+ *-------------------------------------------------------------------------
+ */
- }
- }
+ if (ub_size > 0 && options->ublock_size == 0) {
+ if (copy_user_block(fnamein, fnameout, ub_size) < 0) {
+ error_msg("Could not copy user block. Exiting...\n");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
- return 0;
+ return 0;
- /*-------------------------------------------------------------------------
- * out
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * out
+ *-------------------------------------------------------------------------
+ */
done:
- H5E_BEGIN_TRY
- {
- H5Pclose(fapl);
- H5Pclose(fcpl);
- H5Fclose(fidin);
- H5Fclose(fidout);
- }H5E_END_TRY;
- if (travt)
- trav_table_free(travt);
-
- return -1;
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ H5Fclose(fidin);
+ H5Fclose(fidout);
+ } H5E_END_TRY;
+ if (travt)
+ trav_table_free(travt);
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -470,133 +462,126 @@ done:
*-----------------------------------------*/
int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
- size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) {
+ size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p)
+{
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- int status = 0;
- int k;
- H5D_layout_t dset_layout;
- int rank_chunk;
- hsize_t dims_chunk[H5S_MAX_RANK];
- hsize_t size_chunk = 1;
- hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
- hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
- hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */
- hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
- hsize_t hslab_nbytes; /* size of hyperslab in byte */
-
- /* init to set as size of a data element */
- hslab_nbytes = size_datum;
-
- /* get layout of dataset */
- dset_layout = H5Pget_layout(dcpl_id);
-
- /* if dataset is chunked */
- if (dset_layout == H5D_CHUNKED) {
- /* get chunk dims */
- rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk);
- if (rank_chunk < 0) {
- status = -1;
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ int k;
+ H5D_layout_t dset_layout;
+ int rank_chunk;
+ hsize_t dims_chunk[H5S_MAX_RANK];
+ hsize_t size_chunk = 1;
+ hsize_t nchunk_fit; /* number of chunks that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
+ hsize_t ndatum_fit; /* number of dataum that fits in hyperslab buffer (H5TOOLS_BUFSIZE) */
+ hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */
+ hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
+ hsize_t hslab_nbytes; /* size of hyperslab in byte */
+
+ /* init to set as size of a data element */
+ hslab_nbytes = size_datum;
+
+ /* get layout of dataset */
+ dset_layout = H5Pget_layout(dcpl_id);
+
+ /* if dataset is chunked */
+ if (dset_layout == H5D_CHUNKED) {
+ /* get chunk dims */
+ rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk);
+ if (rank_chunk < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+
+ for (k = rank_dset; k > 0; --k)
+ size_chunk *= dims_chunk[k - 1];
+
+ /* figure out how many chunks can fit in the hyperslab buffer */
+ nchunk_fit = (H5TOOLS_BUFSIZE / size_datum) / size_chunk;
+
+ /* 1. if a chunk fit in hyperslab buffer */
+ if (nchunk_fit >= 1) {
+ /* Calulate a hyperslab that contains as many chunks that can fit
+ * in hyperslab buffer. Hyperslab will be increased starting from
+ * the last dimention of the dataset (see h5dump's dims output).
+ * The calculation boundary is dataset dims.
+ * In the loop, used mapping from a datum to a chunk to figure out
+ * chunk based hyperslab.
+ */
+ for (k = rank_dset; k > 0; --k) {
+ /* map dataset dimentions with a chunk dims */
+ chunk_dims_map[k - 1] = dims_dset[k - 1] / dims_chunk[k - 1];
+
+ /* if reminder exist, increse by 1 to cover partial edge chunks */
+ if (dims_dset[k - 1] % dims_chunk[k - 1] > 0)
+ chunk_dims_map[k - 1]++;
+
+ /* get mapped hyperslab dims */
+ hs_dims_map[k - 1] = MIN (nchunk_fit, chunk_dims_map[k-1]);
+
+ /* prepare next round */
+ nchunk_fit = nchunk_fit / chunk_dims_map[k - 1];
+ /* if a chunk is bigger than the rest of buffer */
+ if (nchunk_fit == 0)
+ nchunk_fit = 1;
+
+ /* get hyperslab dimentions as unmapping to actual size */
+ dims_hslab[k - 1] = MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]);
+
+ /* calculate total size for the hyperslab */
+ hslab_nbytes *= dims_hslab[k - 1];
+ }
}
-
- for (k = rank_dset; k > 0; --k)
- size_chunk *= dims_chunk[k - 1];
-
- /* figure out how many chunks can fit in the hyperslab buffer */
- nchunk_fit = (H5TOOLS_BUFSIZE / size_datum) / size_chunk;
-
- /* 1. if a chunk fit in hyperslab buffer */
- if (nchunk_fit >= 1) {
- /* Calulate a hyperslab that contains as many chunks that can fit
- * in hyperslab buffer. Hyperslab will be increased starting from
- * the last dimention of the dataset (see h5dump's dims output).
- * The calculation boundary is dataset dims.
- * In the loop, used mapping from a datum to a chunk to figure out
- * chunk based hyperslab.
- */
- for (k = rank_dset; k > 0; --k) {
- /* map dataset dimentions with a chunk dims */
- chunk_dims_map[k - 1] = dims_dset[k - 1] / dims_chunk[k - 1];
-
- /* if reminder exist, increse by 1 to cover partial edge chunks */
- if (dims_dset[k - 1] % dims_chunk[k - 1] > 0)
- chunk_dims_map[k - 1]++;
-
- /* get mapped hyperslab dims */
- hs_dims_map[k - 1] = MIN (nchunk_fit, chunk_dims_map[k-1]);
-
- /* prepare next round */
- nchunk_fit = nchunk_fit / chunk_dims_map[k - 1];
- /* if a chunk is bigger than the rest of buffer */
- if (nchunk_fit == 0)
- nchunk_fit = 1;
-
- /* get hyperslab dimentions as unmapping to actual size */
- dims_hslab[k - 1] =
- MIN( (hs_dims_map[k-1] * dims_chunk[k-1]), dims_dset[k-1]);
-
- /* calculate total size for the hyperslab */
- hslab_nbytes *= dims_hslab[k - 1];
- }
- }
- /* 2. if a chunk is bigger than hyperslab buffer */
- else {
- /* Calulate a hyperslab that contains as many data elements that
- * can fit in hyperslab buffer. Hyperslab will be increased
- * starting from the last dimention of the chunk (see h5dump's dims
- * output).
- * The calculation boundary is a chunk dims.
- */
- for (k = rank_dset; k > 0; --k) {
- ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes;
-
- /* if a datum is bigger than rest of buffer */
- if (ndatum_fit == 0)
- ndatum_fit = 1;
- /* get hyperslab dimentions within a chunk boundary */
- dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit);
-
- /* calculate total size for the hyperslab */
- hslab_nbytes *= dims_hslab[k - 1];
-
- if (hslab_nbytes <= 0) {
- status = -1;
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
- }
- }
- }
- }
- /* 3. if dataset is not chunked */
- else {
- /* Calulate a hyperslab that contains as many data elements that can
- * fit in hyperslab buffer. Hyperslab will be increased starting from
- * the last dimention of the dataset (see h5dump's dims output).
- * The calculation boundary is dataset dims.
- */
- for (k = rank_dset; k > 0; --k) {
- ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes;
-
- /* if a datum is bigger than rest of buffer */
- if (ndatum_fit == 0)
- ndatum_fit = 1;
- /* get hyperslab dimentions within dataset boundary */
- dims_hslab[k - 1] = MIN(dims_dset[k - 1], ndatum_fit);
-
- /* calculate total size for the hyperslab */
- hslab_nbytes *= dims_hslab[k - 1];
-
- if (hslab_nbytes <= 0) {
- status = -1;
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ /* 2. if a chunk is bigger than hyperslab buffer */
+ else {
+ /* Calulate a hyperslab that contains as many data elements that
+ * can fit in hyperslab buffer. Hyperslab will be increased
+ * starting from the last dimention of the chunk (see h5dump's dims
+ * output).
+ * The calculation boundary is a chunk dims.
+ */
+ for (k = rank_dset; k > 0; --k) {
+ ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes;
+
+ /* if a datum is bigger than rest of buffer */
+ if (ndatum_fit == 0)
+ ndatum_fit = 1;
+ /* get hyperslab dimentions within a chunk boundary */
+ dims_hslab[k - 1] = MIN (dims_chunk[k-1], ndatum_fit);
+
+ /* calculate total size for the hyperslab */
+ hslab_nbytes *= dims_hslab[k - 1];
+
+ if (hslab_nbytes <= 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
}
- }
- }
+ }
+ }
+ /* 3. if dataset is not chunked */
+ else {
+ /* Calulate a hyperslab that contains as many data elements that can
+ * fit in hyperslab buffer. Hyperslab will be increased starting from
+ * the last dimention of the dataset (see h5dump's dims output).
+ * The calculation boundary is dataset dims.
+ */
+ for (k = rank_dset; k > 0; --k) {
+ ndatum_fit = H5TOOLS_BUFSIZE / hslab_nbytes;
+
+ /* if a datum is bigger than rest of buffer */
+ if (ndatum_fit == 0)
+ ndatum_fit = 1;
+ /* get hyperslab dimentions within dataset boundary */
+ dims_hslab[k - 1] = MIN(dims_dset[k - 1], ndatum_fit);
+
+ /* calculate total size for the hyperslab */
+ hslab_nbytes *= dims_hslab[k - 1];
+
+ if (hslab_nbytes <= 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ }
+ }
- /* pass out the hyperslab size*/
- *hslab_nbytes_p = hslab_nbytes;
+ /* pass out the hyperslab size*/
+ *hslab_nbytes_p = hslab_nbytes;
done:
- return status;
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -698,709 +683,637 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
{
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
hid_t grp_in = -1; /* group ID */
- hid_t grp_out = -1; /* group ID */
- hid_t dset_in = -1; /* read dataset ID */
- hid_t dset_out = -1; /* write dataset ID */
- hid_t gcpl_in = -1; /* group creation property list */
- hid_t gcpl_out = -1; /* group creation property list */
- hid_t type_in = -1; /* named type ID */
- hid_t type_out = -1; /* named type ID */
- hid_t dcpl_in = -1; /* dataset creation property list ID */
- hid_t dcpl_out = -1; /* dataset creation property list ID */
- hid_t f_space_id = -1; /* file space ID */
- hid_t ftype_id = -1; /* file type ID */
- hid_t wtype_id = -1; /* read/write type ID */
- named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
- size_t msize; /* size of type */
- hsize_t nelmts; /* number of elements in dataset */
- H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */
- int rank; /* rank of dataset */
- hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
- hsize_t dsize_in; /* input dataset size before filter */
- hsize_t dsize_out; /* output dataset size after filter */
- int apply_s; /* flag for apply filter to small dataset sizes */
- int apply_f; /* flag for apply filter to return error on H5Dcreate */
- void *buf = NULL; /* buffer for raw data */
- void *hslab_buf = NULL; /* hyperslab buffer for raw data */
- int has_filter; /* current object has a filter */
- int req_filter; /* there was a request for a filter */
- int req_obj_layout = 0; /* request layout to current object */
- unsigned crt_order_flags; /* group creation order flag */
- unsigned i;
- unsigned u;
- int is_ref = 0;
- htri_t is_named;
- hbool_t limit_maxdims;
- hsize_t size_dset;
-
- /*-------------------------------------------------------------------------
- * copy the suppplied object list
- *-------------------------------------------------------------------------
- */
-
- if (options->verbose) {
- printf("-----------------------------------------\n");
- printf(" Type Filter (Compression) Name\n");
- printf("-----------------------------------------\n");
- }
-
- for (i = 0; i < travt->nobjs; i++) {
- /* init variables per obj */
- buf = NULL;
- limit_maxdims = FALSE;
-
- switch (travt->objs[i].type) {
-
- case H5TRAV_TYPE_UNKNOWN:
- HDassert(0);
- break;
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_GROUP
- *-------------------------------------------------------------------------
- */
- case H5TRAV_TYPE_GROUP:
-
- if (options->verbose) {
- printf(FORMAT_OBJ, "group", travt->objs[i].name);
- }
-
- /* open input group */
- if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT))
- < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gopen2 failed");
-
- /* get input group creation property list */
- if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gget_create_plist failed");
-
- /* query and set the group creation properties */
- if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
-
- /* set up group creation property list */
- if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pcreate failed");
-
- if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pset_link_creation_order failed");
-
- /*-------------------------------------------------------------------------
- * the root is a special case, we get an ID for the root group
- * and copy its attributes using that ID
- *-------------------------------------------------------------------------
- */
- if (HDstrcmp(travt->objs[i].name, "/") == 0) {
- if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gopen2 failed");
- }
- else {
-
- if (options->grp_compact > 0 || options->grp_indexed > 0) {
- if (H5Pset_link_phase_change(gcpl_out,
- (unsigned) options->grp_compact,
- (unsigned) options->grp_indexed) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pset_link_phase_change failed");
- }
-
- if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name,
- H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gcreate2 failed");
-
- }
-
- /*-------------------------------------------------------------------------
- * copy attrs
- *-------------------------------------------------------------------------
- */
- if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_attr failed");
-
- if (H5Pclose(gcpl_out) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
- if (H5Pclose(gcpl_in) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
- if (H5Gclose(grp_out) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gclose failed");
- if (H5Gclose(grp_in) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gclose failed");
-
- break;
-
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_DATASET
- *-------------------------------------------------------------------------
- */
- case H5TRAV_TYPE_DATASET:
-
- has_filter = 0;
- req_filter = 0;
-
- /* check if global filters were requested */
- if (options->n_filter_g)
- req_filter = 1;
-
- /* check if filters were requested for individual objects */
- for (u = 0; u < options->op_tbl->nelems; u++) {
-
- if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) {
- if (options->op_tbl->objs[u].filter->filtn > 0) {
- req_filter = 1;
- }
- }
- }
-
- /* check if layout change requested individual object */
- if (options->layout_g != H5D_LAYOUT_ERROR) {
- pack_info_t *pckinfo;
- /* any dataset is specified */
- if (options->op_tbl->nelems > 0) {
- /* check if object exist */
- pckinfo = options_get_object(travt->objs[i].name,
- options->op_tbl);
- if (pckinfo) {
- req_obj_layout = 1;
- }
- }
- }
-
- /* early detection of references */
- if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT))
- < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed");
- if ((ftype_id = H5Dget_type(dset_in)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_type failed");
- if (H5T_REFERENCE == H5Tget_class(ftype_id))
- is_ref = 1;
-
- /* Check if the datatype is committed */
- if ((is_named = H5Tcommitted(ftype_id)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tcommitted failed");
- if (is_named)
- if ((wtype_id = copy_named_datatype(ftype_id, fidout,
- &named_dt_head, travt, options)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_named_datatype failed");
-
- if (H5Tclose(ftype_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
- if (H5Dclose(dset_in) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed");
-
- /*-------------------------------------------------------------------------
- * check if we should use H5Ocopy or not
- * if there is a request for filters/layout, we read/write the object
- * otherwise we do a copy using H5Ocopy
- *-------------------------------------------------------------------------
- */
- if (options->op_tbl->nelems || options->all_filter == 1
- || options->all_layout == 1 || is_ref || is_named) {
-
- int j;
-
- if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed");
- if ((f_space_id = H5Dget_space(dset_in)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_space failed");
- if ((ftype_id = H5Dget_type(dset_in)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_type failed");
- if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_create_plist failed");
- if ((dcpl_out = H5Pcopy(dcpl_in)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pcopy failed");
- if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
- HDmemset(dims, 0, sizeof dims);
- if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
-
- if (H5Dget_space_status(dset_in, &space_status) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_space_status failed");
-
- nelmts = 1;
- for (j = 0; j < rank; j++)
- nelmts *= dims[j];
-
- /* wtype_id will have already been set if using a named dtype */
- if (!is_named) {
- if (options->use_native == 1)
- wtype_id = h5tools_get_native_type(ftype_id);
- else
- wtype_id = H5Tcopy(ftype_id);
- } /* end if */
-
- if ((msize = H5Tget_size(wtype_id)) == 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_size failed");
-
- /* size of current dset */
- size_dset = nelmts * msize;
-
- /*-------------------------------------------------------------------------
- * check if the dataset creation property list has filters that
- * are not registered in the current configuration
- * 1) the external filters GZIP and SZIP might not be available
- * 2) the internal filters might be turned off
- *-------------------------------------------------------------------------
- */
- if (h5tools_canreadf((travt->objs[i].name), dcpl_in) == 1) {
- apply_s = 1;
- apply_f = 1;
-
- /*-------------------------------------------------------------------------
- * references are a special case
- * we cannot just copy the buffers, but instead we recreate the reference
- * in a second traversal of the output file
- *-------------------------------------------------------------------------
- */
- if (H5T_REFERENCE != H5Tget_class(wtype_id)) {
- /* get the storage size of the input dataset */
- dsize_in = H5Dget_storage_size(dset_in);
-
- /* check for small size datasets (less than 1k) except
- * changing to COMPACT. For the reference, COMPACT is limited
- * by size 64K by library.
- */
- if (options->layout_g != H5D_COMPACT) {
- if (size_dset < options->min_comp)
- apply_s = 0;
- }
-
- /* apply the filter */
- if (apply_s) {
- if (apply_filters(travt->objs[i].name, rank, dims,
- msize, dcpl_out, options, &has_filter) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "apply_filters failed");
- }
-
- /* only if layout change requested for entire file or
- * individual obj */
- if (options->all_layout > 0 || req_obj_layout == 1)
- /*-------------------------------------------------
- * Unset the unlimited max dims if convert to other
- * than chunk layouts, because unlimited max dims
- * only can be applied to chunk layout.
- * Also perform only for targeted dataset
- * Also check for size limit to convert to compact
- *-------------------------------------------------*/
- if (options->layout_g != H5D_CHUNKED) {
- /* any dataset is specified */
- if (options->op_tbl->nelems > 0) {
- /* if current obj match specified obj */
- if (options_get_object(travt->objs[i].name,
- options->op_tbl))
- limit_maxdims = TRUE;
- }
- else { /* no dataset is specified */
- limit_maxdims = TRUE;
- }
-
- /* if convert to COMPACT */
- if (options->layout_g == H5D_COMPACT) {
- /* should be smaller than 64K */
- if (size_dset > MAX_COMPACT_DSIZE)
- limit_maxdims = FALSE;
- }
-
- /* unset unlimited max dims */
- if (limit_maxdims)
- H5Sset_extent_simple(f_space_id, rank, dims,
- NULL);
- }
-
- /*-------------------------------------------------------------------------
- * create the output dataset;
- * disable error checking in case the dataset cannot be created with the
- * modified dcpl; in that case use the original instead
- *-------------------------------------------------------------------------
- */
- dset_out = H5Dcreate2(fidout,
- travt->objs[i].name, wtype_id,
- f_space_id, H5P_DEFAULT, dcpl_out,
- H5P_DEFAULT);
-
- if (dset_out == FAIL) {
- HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed");
- if (options->verbose)
- printf(
- " warning: could not create dataset <%s>. Applying original settings\n",
- travt->objs[i].name);
-
- if ((dset_out = H5Dcreate2(fidout,
- travt->objs[i].name, wtype_id, f_space_id,
- H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed");
- apply_f = 0;
- }
-
- /*-------------------------------------------------------------------------
- * read/write
- *-------------------------------------------------------------------------
- */
- if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) {
- size_t need = (size_t)(nelmts * msize); /* bytes needed */
-
- /* have to read the whole dataset if there is only one element in the dataset */
- if (need < H5TOOLS_MALLOCSIZE)
- buf = HDmalloc(need);
-
- if (buf != NULL) {
- /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */
- CHECK_H5DRW_ERROR(H5Dread, dset_in, wtype_id,
- H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- CHECK_H5DRW_ERROR(H5Dwrite, dset_out, wtype_id,
- H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
-
- /* Check if we have VL data in the dataset's
- * datatype that must be reclaimed */
- if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
- if (H5Dvlen_reclaim(wtype_id, f_space_id,
- H5P_DEFAULT, buf) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dvlen_reclaim failed");
- }
- else { /* possibly not enough memory, read/write by hyperslabs */
- size_t p_type_nbytes = msize; /*size of memory type */
- hsize_t p_nelmts = nelmts; /*total elements */
- hsize_t elmtno; /*counter */
- int carry; /*counter carry value */
- unsigned int vl_data = 0; /*contains VL datatypes */
-
- /* hyperslab info */
- hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */
- hsize_t hslab_nbytes; /*bytes per hyperslab */
- hsize_t hslab_nelmts; /*elements per hyperslab*/
- hid_t hslab_space; /*hyperslab data space */
-
- /* hyperslab selection info */
- hsize_t hs_sel_offset[H5S_MAX_RANK];/* selection offset */
- hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */
- hsize_t hs_select_nelmts; /* selected elements */
- hsize_t zero[8]; /*vector of zeros */
- int k;
- H5D_layout_t dset_layout;
- hid_t dcpl_tmp = -1; /* dataset creation property list ID */
-
- /* check if we have VL data in the dataset's datatype */
- if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE)
- vl_data = TRUE;
-
- /* check first if writing dataset is chunked,
- * if so use its chunk layout for better performance. */
- dset_layout = H5Pget_layout(dcpl_out);
- if (dset_layout == H5D_CHUNKED)
- dcpl_tmp = dcpl_out; /* writing dataset */
- else { /* if reading dataset is chunked */
- dset_layout = H5Pget_layout(dcpl_in);
- if (dset_layout == H5D_CHUNKED)
- dcpl_tmp = dcpl_in; /* reading dataset */
- }
-
- /* get hyperslab dims and size in byte */
- if (Get_hyperslab(dcpl_tmp, rank, dims,
- p_type_nbytes, hslab_dims,
- &hslab_nbytes) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "Get_hyperslab failed");
-
- hslab_buf = HDmalloc((size_t)hslab_nbytes);
-
- hslab_nelmts = hslab_nbytes / p_type_nbytes;
- hslab_space = H5Screate_simple(1, &hslab_nelmts,
- NULL);
-
- /* the hyperslab selection loop */
- HDmemset(hs_sel_offset, 0,
- sizeof hs_sel_offset);
- HDmemset(zero, 0, sizeof zero);
-
- for (elmtno = 0; elmtno < p_nelmts; elmtno +=
- hs_select_nelmts) {
- if (rank > 0) {
- /* calculate the hyperslab selections. The selection would be same as the hyperslab except for remaining edge portion of the dataset which is smaller then the hyperslab.
- */
- for (k = 0, hs_select_nelmts = 1;
- k < rank; k++) {
- /* MIN() is used to get the remaining edge portion if exist.
- * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/
- hs_sel_count[k] =
- MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]);
- hs_select_nelmts *= hs_sel_count[k];
- }
-
- if (H5Sselect_hyperslab(f_space_id,
- H5S_SELECT_SET, hs_sel_offset,
- NULL, hs_sel_count, NULL) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
- if (H5Sselect_hyperslab(hslab_space,
- H5S_SELECT_SET, zero, NULL,
- &hs_select_nelmts, NULL) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
- }
- else {
- H5Sselect_all(f_space_id);
- H5Sselect_all(hslab_space);
- hs_select_nelmts = 1;
- } /* rank */
-
- /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */
- CHECK_H5DRW_ERROR(H5Dread, dset_in,
- wtype_id, hslab_space, f_space_id,
- H5P_DEFAULT, hslab_buf);
- CHECK_H5DRW_ERROR(H5Dwrite, dset_out,
- wtype_id, hslab_space, f_space_id,
- H5P_DEFAULT, hslab_buf);
-
- /* reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(wtype_id, hslab_space,
- H5P_DEFAULT, hslab_buf);
-
- /* calculate the next hyperslab offset */
- for (k = rank, carry = 1; k > 0 && carry;
- --k) {
- hs_sel_offset[k - 1] += hs_sel_count[k
- - 1];
- /* if reached the end of a dim */
- if (hs_sel_offset[k - 1] == dims[k - 1])
- hs_sel_offset[k - 1] = 0;
- else
- carry = 0;
- } /* k */
- } /* elmtno */
-
- H5Sclose(hslab_space);
- /* free */
- if (hslab_buf != NULL) {
- HDfree(hslab_buf);
- hslab_buf = NULL;
- }
- } /* hyperslab read */
- } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */
-
- /*-------------------------------------------------------------------------
- * amount of compression used
- *-------------------------------------------------------------------------
- */
- if (options->verbose) {
- double ratio = 0;
-
- /* only print the compression ration if there was a filter request */
- if (apply_s && apply_f && req_filter) {
- /* get the storage size of the output dataset */
- dsize_out = H5Dget_storage_size(dset_out);
-
- /* compression ratio = uncompressed size / compressed size */
- if (dsize_out != 0)
- ratio = (double) dsize_in
- / (double) dsize_out;
-
- print_dataset_info(dcpl_out,
- travt->objs[i].name, ratio, 1);
- }
- else
- print_dataset_info(dcpl_in, travt->objs[i].name,
- ratio, 0);
-
- /* print a message that the filter was not applied
- (in case there was a filter)
- */
- if (has_filter && apply_s == 0)
- printf(
- " <warning: filter not applied to %s. dataset smaller than %d bytes>\n",
- travt->objs[i].name,
- (int) options->min_comp);
-
- if (has_filter && apply_f == 0)
- printf(
- " <warning: could not apply the filter to %s>\n",
- travt->objs[i].name);
-
- } /* verbose */
-
- /*-------------------------------------------------------------------------
- * copy attrs
- *-------------------------------------------------------------------------
- */
- if (copy_attr(dset_in, dset_out, &named_dt_head, travt,
- options) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_attr failed");
- /*close */
- if (H5Dclose(dset_out) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed");
-
- }/*!H5T_REFERENCE*/
- }/*h5tools_canreadf*/
-
- /*-------------------------------------------------------------------------
- * close
- *-------------------------------------------------------------------------
- */
- if (H5Tclose(ftype_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
- if (H5Tclose(wtype_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
- if (H5Pclose(dcpl_in) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
- if (H5Pclose(dcpl_out) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
- if (H5Sclose(f_space_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
- if (H5Dclose(dset_in) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed");
-
- }
- /*-------------------------------------------------------------------------
- * we do not have request for filter/chunking use H5Ocopy instead
- *-------------------------------------------------------------------------
- */
- else {
- hid_t pid;
-
- /* create property to pass copy options */
- if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pcreate failed");
-
- /* set options for object copy */
- if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pset_copy_object failed");
-
- /*-------------------------------------------------------------------------
- * do the copy
- *-------------------------------------------------------------------------
- */
-
- if (H5Ocopy(fidin, /* Source file or group identifier */
- travt->objs[i].name, /* Name of the source object to be copied */
- fidout, /* Destination file or group identifier */
- travt->objs[i].name, /* Name of the destination object */
- pid, /* Properties which apply to the copy */
- H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ocopy failed");
-
- /* close property */
- if (H5Pclose(pid) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
-
- /*-------------------------------------------------------------------------
- * copy attrs manually
- *-------------------------------------------------------------------------
- */
- if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT))
- < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed");
- if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed");
- if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_attr failed");
- if (H5Dclose(dset_in) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed");
- if (H5Dclose(dset_out) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed");
-
- if (options->verbose)
- printf(FORMAT_OBJ, "dset", travt->objs[i].name);
-
- } /* end do we have request for filter/chunking */
-
- break;
-
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_NAMED_DATATYPE
- *-------------------------------------------------------------------------
- */
- case H5TRAV_TYPE_NAMED_DATATYPE:
-
- if (options->verbose)
- printf(FORMAT_OBJ, "type", travt->objs[i].name);
-
- if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Topen2 failed");
+ hid_t grp_out = -1; /* group ID */
+ hid_t dset_in = -1; /* read dataset ID */
+ hid_t dset_out = -1; /* write dataset ID */
+ hid_t gcpl_in = -1; /* group creation property list */
+ hid_t gcpl_out = -1; /* group creation property list */
+ hid_t type_in = -1; /* named type ID */
+ hid_t type_out = -1; /* named type ID */
+ hid_t dcpl_in = -1; /* dataset creation property list ID */
+ hid_t dcpl_out = -1; /* dataset creation property list ID */
+ hid_t f_space_id = -1; /* file space ID */
+ hid_t ftype_id = -1; /* file type ID */
+ hid_t wtype_id = -1; /* read/write type ID */
+ named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
+ size_t msize; /* size of type */
+ hsize_t nelmts; /* number of elements in dataset */
+ H5D_space_status_t space_status; /* determines whether space has been allocated for the dataset */
+ int rank; /* rank of dataset */
+ hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
+ hsize_t dsize_in; /* input dataset size before filter */
+ hsize_t dsize_out; /* output dataset size after filter */
+ int apply_s; /* flag for apply filter to small dataset sizes */
+ int apply_f; /* flag for apply filter to return error on H5Dcreate */
+ void *buf = NULL; /* buffer for raw data */
+ void *hslab_buf = NULL; /* hyperslab buffer for raw data */
+ int has_filter; /* current object has a filter */
+ int req_filter; /* there was a request for a filter */
+ int req_obj_layout = 0; /* request layout to current object */
+ unsigned crt_order_flags; /* group creation order flag */
+ unsigned i;
+ unsigned u;
+ int is_ref = 0;
+ htri_t is_named;
+ hbool_t limit_maxdims;
+ hsize_t size_dset;
- /* Copy the datatype anonymously */
- if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head,
- travt, options)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_named_datatype failed");
-
- /* Link in to group structure */
- if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name,
- H5P_DEFAULT, H5P_DEFAULT) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Lcreate_hard failed");
-
- /*-------------------------------------------------------------------------
- * copy attrs
- *-------------------------------------------------------------------------
- */
- if (copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_attr failed");
-
- if (H5Tclose(type_in) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
- if (H5Tclose(type_out) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ /*-------------------------------------------------------------------------
+ * copy the suppplied object list
+ *-------------------------------------------------------------------------
+ */
- break;
+ if (options->verbose) {
+ printf("-----------------------------------------\n");
+ printf(" Type Filter (Compression) Name\n");
+ printf("-----------------------------------------\n");
+ }
- /*-------------------------------------------------------------------------
- * H5TRAV_TYPE_LINK
- * H5TRAV_TYPE_UDLINK
- *
- * Only handles external links; H5Lcopy will fail for other UD link types
- * since we don't have creation or copy callbacks for them.
- *-------------------------------------------------------------------------
- */
+ for (i = 0; i < travt->nobjs; i++) {
+ /* init variables per obj */
+ buf = NULL;
+ limit_maxdims = FALSE;
+
+ switch (travt->objs[i].type) {
+ case H5TRAV_TYPE_UNKNOWN:
+ HDassert(0);
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_GROUP
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_GROUP:
+ if (options->verbose)
+ printf(FORMAT_OBJ, "group", travt->objs[i].name);
+
+ /* open input group */
+ if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
+
+ /* get input group creation property list */
+ if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed");
+
+ /* query and set the group creation properties */
+ if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
+
+ /* set up group creation property list */
+ if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed");
+
+ if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_creation_order failed");
+
+ /*-------------------------------------------------------------------------
+ * the root is a special case, we get an ID for the root group
+ * and copy its attributes using that ID
+ *-------------------------------------------------------------------------
+ */
+ if (HDstrcmp(travt->objs[i].name, "/") == 0) {
+ if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
+ }
+ else {
+ if (options->grp_compact > 0 || options->grp_indexed > 0)
+ if (H5Pset_link_phase_change(gcpl_out, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed");
- case H5TRAV_TYPE_LINK:
- case H5TRAV_TYPE_UDLINK: {
+ if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gcreate2 failed");
+ }
- if (options->verbose)
- printf(FORMAT_OBJ, "link", travt->objs[i].name);
+ /*-------------------------------------------------------------------------
+ * copy attrs
+ *-------------------------------------------------------------------------
+ */
+ if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
+
+ if (H5Pclose(gcpl_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Pclose(gcpl_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Gclose(grp_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+ if (H5Gclose(grp_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_DATASET
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_DATASET:
+ has_filter = 0;
+ req_filter = 0;
+
+ /* check if global filters were requested */
+ if (options->n_filter_g)
+ req_filter = 1;
+
+ /* check if filters were requested for individual objects */
+ for (u = 0; u < options->op_tbl->nelems; u++)
+ if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0)
+ if (options->op_tbl->objs[u].filter->filtn > 0)
+ req_filter = 1;
+
+ /* check if layout change requested individual object */
+ if (options->layout_g != H5D_LAYOUT_ERROR) {
+ pack_info_t *pckinfo;
+
+ /* any dataset is specified */
+ if (options->op_tbl->nelems > 0) {
+ /* check if object exist */
+ pckinfo = options_get_object(travt->objs[i].name, options->op_tbl);
+ if (pckinfo)
+ req_obj_layout = 1;
+ }
+ }
- if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name,
- H5P_DEFAULT, H5P_DEFAULT) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Lcopy failed");
+ /* early detection of references */
+ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if ((ftype_id = H5Dget_type(dset_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+ if (H5T_REFERENCE == H5Tget_class(ftype_id))
+ is_ref = 1;
+
+ /* Check if the datatype is committed */
+ if ((is_named = H5Tcommitted(ftype_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed");
+ if (is_named)
+ if ((wtype_id = copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed");
+
+ if (H5Tclose(ftype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if (H5Dclose(dset_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+
+ /*-------------------------------------------------------------------------
+ * check if we should use H5Ocopy or not
+ * if there is a request for filters/layout, we read/write the object
+ * otherwise we do a copy using H5Ocopy
+ *-------------------------------------------------------------------------
+ */
+ if (options->op_tbl->nelems || options->all_filter == 1
+ || options->all_layout == 1 || is_ref || is_named) {
+
+ int j;
+
+ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if ((f_space_id = H5Dget_space(dset_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ if ((ftype_id = H5Dget_type(dset_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
+ if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ if ((dcpl_out = H5Pcopy(dcpl_in)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed");
+ if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ HDmemset(dims, 0, sizeof dims);
+ if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ if (H5Dget_space_status(dset_in, &space_status) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space_status failed");
+
+ nelmts = 1;
+ for (j = 0; j < rank; j++)
+ nelmts *= dims[j];
+
+ /* wtype_id will have already been set if using a named dtype */
+ if (!is_named) {
+ if (options->use_native == 1)
+ wtype_id = h5tools_get_native_type(ftype_id);
+ else
+ wtype_id = H5Tcopy(ftype_id);
+ } /* end if */
- if (options->verbose)
- printf(FORMAT_OBJ, "link", travt->objs[i].name);
+ if ((msize = H5Tget_size(wtype_id)) == 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+
+ /* size of current dset */
+ size_dset = nelmts * msize;
+
+ /*-------------------------------------------------------------------------
+ * check if the dataset creation property list has filters that
+ * are not registered in the current configuration
+ * 1) the external filters GZIP and SZIP might not be available
+ * 2) the internal filters might be turned off
+ *-------------------------------------------------------------------------
+ */
+ if (h5tools_canreadf((travt->objs[i].name), dcpl_in) == 1) {
+ apply_s = 1;
+ apply_f = 1;
+
+ /*-------------------------------------------------------------------------
+ * references are a special case
+ * we cannot just copy the buffers, but instead we recreate the reference
+ * in a second traversal of the output file
+ *-------------------------------------------------------------------------
+ */
+ if (H5T_REFERENCE != H5Tget_class(wtype_id)) {
+ /* get the storage size of the input dataset */
+ dsize_in = H5Dget_storage_size(dset_in);
+
+ /* check for small size datasets (less than 1k) except
+ * changing to COMPACT. For the reference, COMPACT is limited
+ * by size 64K by library.
+ */
+ if (options->layout_g != H5D_COMPACT)
+ if (size_dset < options->min_comp)
+ apply_s = 0;
+
+ /* apply the filter */
+ if (apply_s)
+ if (apply_filters(travt->objs[i].name, rank, dims, msize, dcpl_out, options, &has_filter) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "apply_filters failed");
+
+ /* only if layout change requested for entire file or
+ * individual obj */
+ if (options->all_layout > 0 || req_obj_layout == 1)
+ /*-------------------------------------------------
+ * Unset the unlimited max dims if convert to other
+ * than chunk layouts, because unlimited max dims
+ * only can be applied to chunk layout.
+ * Also perform only for targeted dataset
+ * Also check for size limit to convert to compact
+ *-------------------------------------------------*/
+ if (options->layout_g != H5D_CHUNKED) {
+ /* any dataset is specified */
+ if (options->op_tbl->nelems > 0) {
+ /* if current obj match specified obj */
+ if (options_get_object(travt->objs[i].name, options->op_tbl))
+ limit_maxdims = TRUE;
+ }
+ else /* no dataset is specified */
+ limit_maxdims = TRUE;
+
+ /* if convert to COMPACT */
+ if (options->layout_g == H5D_COMPACT)
+ /* should be smaller than 64K */
+ if (size_dset > MAX_COMPACT_DSIZE)
+ limit_maxdims = FALSE;
+
+ /* unset unlimited max dims */
+ if (limit_maxdims)
+ H5Sset_extent_simple(f_space_id, rank, dims, NULL);
+ }
+
+ /*-------------------------------------------------------------------------
+ * create the output dataset;
+ * disable error checking in case the dataset cannot be created with the
+ * modified dcpl; in that case use the original instead
+ *-------------------------------------------------------------------------
+ */
+ dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT);
+ if (dset_out == FAIL) {
+ H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed");
+ if (options->verbose)
+ printf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name);
+
+ if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed");
+ apply_f = 0;
+ }
- }
- break;
+ /*-------------------------------------------------------------------------
+ * read/write
+ *-------------------------------------------------------------------------
+ */
+ if (nelmts > 0 && space_status != H5D_SPACE_STATUS_NOT_ALLOCATED) {
+ size_t need = (size_t)(nelmts * msize); /* bytes needed */
+
+ /* have to read the whole dataset if there is only one element in the dataset */
+ if (need < H5TOOLS_MALLOCSIZE)
+ buf = HDmalloc(need);
+
+ if (buf != NULL) {
+ /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */
+ CHECK_H5DRW_ERROR(H5Dread, FAIL, dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ CHECK_H5DRW_ERROR(H5Dwrite, FAIL, dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* Check if we have VL data in the dataset's
+ * datatype that must be reclaimed */
+ if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN))
+ if (H5Dvlen_reclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dvlen_reclaim failed");
+ }
+ else { /* possibly not enough memory, read/write by hyperslabs */
+ size_t p_type_nbytes = msize; /*size of memory type */
+ hsize_t p_nelmts = nelmts; /*total elements */
+ hsize_t elmtno; /*counter */
+ int carry; /*counter carry value */
+ unsigned int vl_data = 0; /*contains VL datatypes */
+
+ /* hyperslab info */
+ hsize_t hslab_dims[H5S_MAX_RANK]; /*hyperslab dims */
+ hsize_t hslab_nbytes; /*bytes per hyperslab */
+ hsize_t hslab_nelmts; /*elements per hyperslab*/
+ hid_t hslab_space; /*hyperslab data space */
+
+ /* hyperslab selection info */
+ hsize_t hs_sel_offset[H5S_MAX_RANK];/* selection offset */
+ hsize_t hs_sel_count[H5S_MAX_RANK]; /* selection count */
+ hsize_t hs_select_nelmts; /* selected elements */
+ hsize_t zero[8]; /*vector of zeros */
+ int k;
+ H5D_layout_t dset_layout;
+ hid_t dcpl_tmp = -1; /* dataset creation property list ID */
+
+ /* check if we have VL data in the dataset's datatype */
+ if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE)
+ vl_data = TRUE;
+
+ /* check first if writing dataset is chunked,
+ * if so use its chunk layout for better performance. */
+ dset_layout = H5Pget_layout(dcpl_out);
+ if (dset_layout == H5D_CHUNKED)
+ dcpl_tmp = dcpl_out; /* writing dataset */
+ else { /* if reading dataset is chunked */
+ dset_layout = H5Pget_layout(dcpl_in);
+ if (dset_layout == H5D_CHUNKED)
+ dcpl_tmp = dcpl_in; /* reading dataset */
+ }
- default:
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "Object type not found");
+ /* get hyperslab dims and size in byte */
+ if (Get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Get_hyperslab failed");
+
+ hslab_buf = HDmalloc((size_t)hslab_nbytes);
+
+ hslab_nelmts = hslab_nbytes / p_type_nbytes;
+ hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL);
+
+ /* the hyperslab selection loop */
+ HDmemset(hs_sel_offset, 0, sizeof hs_sel_offset);
+ HDmemset(zero, 0, sizeof zero);
+
+ for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_select_nelmts) {
+ if (rank > 0) {
+ /* calculate the hyperslab selections.
+ * The selection would be same as the hyperslab
+ * except for remaining edge portion of the dataset
+ * which is smaller then the hyperslab.
+ */
+ for (k = 0, hs_select_nelmts = 1; k < rank; k++) {
+ /* MIN() is used to get the remaining edge portion if exist.
+ * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/
+ hs_sel_count[k] = MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]);
+ hs_select_nelmts *= hs_sel_count[k];
+ }
+
+ if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_sel_offset, NULL, hs_sel_count, NULL) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ }
+ else {
+ H5Sselect_all(f_space_id);
+ H5Sselect_all(hslab_space);
+ hs_select_nelmts = 1;
+ } /* rank */
+
+ /* read/write: use the macro to check error, e.g. memory allocation error inside the library. */
+ CHECK_H5DRW_ERROR(H5Dread, FAIL, dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf);
+ CHECK_H5DRW_ERROR(H5Dwrite, FAIL, dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf);
+
+ /* reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(wtype_id, hslab_space, H5P_DEFAULT, hslab_buf);
+
+ /* calculate the next hyperslab offset */
+ for (k = rank, carry = 1; k > 0 && carry; --k) {
+ hs_sel_offset[k - 1] += hs_sel_count[k - 1];
+ /* if reached the end of a dim */
+ if (hs_sel_offset[k - 1] == dims[k - 1])
+ hs_sel_offset[k - 1] = 0;
+ else
+ carry = 0;
+ } /* k */
+ } /* elmtno */
+
+ H5Sclose(hslab_space);
+ /* free */
+ if (hslab_buf != NULL) {
+ HDfree(hslab_buf);
+ hslab_buf = NULL;
+ }
+ } /* hyperslab read */
+ } /* if (nelmts>0 && space_status==H5D_SPACE_STATUS_NOT_ALLOCATED) */
+
+ /*-------------------------------------------------------------------------
+ * amount of compression used
+ *-------------------------------------------------------------------------
+ */
+ if (options->verbose) {
+ double ratio = 0;
+
+ /* only print the compression ration if there was a filter request */
+ if (apply_s && apply_f && req_filter) {
+ /* get the storage size of the output dataset */
+ dsize_out = H5Dget_storage_size(dset_out);
+
+ /* compression ratio = uncompressed size / compressed size */
+ if (dsize_out != 0)
+ ratio = (double) dsize_in / (double) dsize_out;
+ print_dataset_info(dcpl_out, travt->objs[i].name, ratio, 1);
+ }
+ else
+ print_dataset_info(dcpl_in, travt->objs[i].name, ratio, 0);
+
+ /* print a message that the filter was not applied
+ (in case there was a filter)
+ */
+ if (has_filter && apply_s == 0)
+ printf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n", travt->objs[i].name, (int) options->min_comp);
+
+ if (has_filter && apply_f == 0)
+ printf(" <warning: could not apply the filter to %s>\n", travt->objs[i].name);
+ } /* verbose */
+
+ /*-------------------------------------------------------------------------
+ * copy attrs
+ *-------------------------------------------------------------------------
+ */
+ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
+
+ /*close */
+ if (H5Dclose(dset_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ }/*!H5T_REFERENCE*/
+ }/*h5tools_canreadf*/
+
+ /*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+ if (H5Tclose(ftype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if (H5Tclose(wtype_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if (H5Pclose(dcpl_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Pclose(dcpl_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Sclose(f_space_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ if (H5Dclose(dset_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ }
+ /*-------------------------------------------------------------------------
+ * we do not have request for filter/chunking use H5Ocopy instead
+ *-------------------------------------------------------------------------
+ */
+ else {
+ hid_t pid;
+
+ /* create property to pass copy options */
+ if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed");
+
+ /* set options for object copy */
+ if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_copy_object failed");
+
+ /*-------------------------------------------------------------------------
+ * do the copy
+ *-------------------------------------------------------------------------
+ */
+
+ if (H5Ocopy(fidin, /* Source file or group identifier */
+ travt->objs[i].name, /* Name of the source object to be copied */
+ fidout, /* Destination file or group identifier */
+ travt->objs[i].name, /* Name of the destination object */
+ pid, /* Properties which apply to the copy */
+ H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Ocopy failed");
+
+ /* close property */
+ if (H5Pclose(pid) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+
+ /*-------------------------------------------------------------------------
+ * copy attrs manually
+ *-------------------------------------------------------------------------
+ */
+ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
+ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
+ if (H5Dclose(dset_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ if (H5Dclose(dset_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+
+ if (options->verbose)
+ printf(FORMAT_OBJ, "dset", travt->objs[i].name);
+
+ } /* end do we have request for filter/chunking */
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_NAMED_DATATYPE
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_NAMED_DATATYPE:
+ if (options->verbose)
+ printf(FORMAT_OBJ, "type", travt->objs[i].name);
+
+ if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed");
+
+ /* Copy the datatype anonymously */
+ if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, travt, options)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed");
+
+ /* Link in to group structure */
+ if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcreate_hard failed");
+
+ /*-------------------------------------------------------------------------
+ * copy attrs
+ *-------------------------------------------------------------------------
+ */
+ if (copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
+
+ if (H5Tclose(type_in) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ if (H5Tclose(type_out) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5TRAV_TYPE_LINK
+ * H5TRAV_TYPE_UDLINK
+ *
+ * Only handles external links; H5Lcopy will fail for other UD link types
+ * since we don't have creation or copy callbacks for them.
+ *-------------------------------------------------------------------------
+ */
+ case H5TRAV_TYPE_LINK:
+ case H5TRAV_TYPE_UDLINK:
+ if (options->verbose)
+ printf(FORMAT_OBJ, "link", travt->objs[i].name);
+
+ if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcopy failed");
+
+ if (options->verbose)
+ printf(FORMAT_OBJ, "link", travt->objs[i].name);
+ break;
+
+ default:
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Object type not found");
} /* switch */
- /* free */
- if (buf != NULL) {
- HDfree(buf);
- buf = NULL;
- }
+ /* free */
+ if (buf != NULL) {
+ HDfree(buf);
+ buf = NULL;
+ }
+ } /* i */
- } /* i */
+ /* Finalize (link) the stack of named datatypes (if any) */
+ named_datatype_free(&named_dt_head, 0);
- /* Finalize (link) the stack of named datatypes (if any) */
- named_datatype_free(&named_dt_head, 0);
-
- return 0;
+ return ret_value;
done:
- H5E_BEGIN_TRY
- {
- H5Gclose(grp_in);
- H5Gclose(grp_out);
- H5Pclose(dcpl_in);
- H5Pclose(gcpl_in);
- H5Pclose(gcpl_out);
- H5Sclose(f_space_id);
- H5Dclose(dset_in);
- H5Dclose(dset_out);
- H5Tclose(ftype_id);
- H5Tclose(wtype_id);
- H5Tclose(type_in);
- H5Tclose(type_out);
- named_datatype_free(&named_dt_head, 1);
- }H5E_END_TRY;
- /* free */
- if (buf != NULL)
- HDfree(buf);
- if (hslab_buf != NULL)
- HDfree(hslab_buf);
- return -1;
+ H5E_BEGIN_TRY
+ {
+ H5Gclose(grp_in);
+ H5Gclose(grp_out);
+ H5Pclose(dcpl_in);
+ H5Pclose(gcpl_in);
+ H5Pclose(gcpl_out);
+ H5Sclose(f_space_id);
+ H5Dclose(dset_in);
+ H5Dclose(dset_out);
+ H5Tclose(ftype_id);
+ H5Tclose(wtype_id);
+ H5Tclose(type_in);
+ H5Tclose(type_out);
+ named_datatype_free(&named_dt_head, 1);
+ }H5E_END_TRY;
+
+ /* free */
+ if (buf != NULL)
+ HDfree(buf);
+ if (hslab_buf != NULL)
+ HDfree(hslab_buf);
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -1411,101 +1324,102 @@ done:
*-------------------------------------------------------------------------
*/
static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio,
- int pr) {
- char strfilter[255];
+ int pr)
+{
+ char strfilter[255];
#if defined (PRINT_DEBUG )
- char temp[255];
+ char temp[255];
#endif
- int nfilters; /* number of filters */
- unsigned filt_flags; /* filter flags */
- H5Z_filter_t filtn; /* filter identification number */
- unsigned cd_values[20]; /* filter client data values */
- size_t cd_nelmts; /* filter client number of values */
- char f_objname[256]; /* filter objname */
- int i;
-
- HDstrcpy(strfilter, "\0");
+ int nfilters; /* number of filters */
+ unsigned filt_flags; /* filter flags */
+ H5Z_filter_t filtn; /* filter identification number */
+ unsigned cd_values[20]; /* filter client data values */
+ size_t cd_nelmts; /* filter client number of values */
+ char f_objname[256]; /* filter objname */
+ int i;
- /* get information about input filters */
- if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
- return;
+ HDstrcpy(strfilter, "\0");
- for (i = 0; i < nfilters; i++) {
- cd_nelmts = NELMTS(cd_values);
+ /* get information about input filters */
+ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
+ return;
- filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts,
- cd_values, sizeof(f_objname), f_objname, NULL);
+ for (i = 0; i < nfilters; i++) {
+ cd_nelmts = NELMTS(cd_values);
- switch (filtn) {
+ filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &filt_flags, &cd_nelmts,
+ cd_values, sizeof(f_objname), f_objname, NULL);
- case H5Z_FILTER_NONE:
- HDstrcat(strfilter, "NONE ");
- break;
+ switch (filtn) {
+ case H5Z_FILTER_NONE:
+ HDstrcat(strfilter, "NONE ");
+ break;
- case H5Z_FILTER_DEFLATE:
- HDstrcat(strfilter, "GZIP ");
+ case H5Z_FILTER_DEFLATE:
+ HDstrcat(strfilter, "GZIP ");
#if defined (PRINT_DEBUG)
- {
- unsigned level=cd_values[0];
- sprintf(temp,"(%d)",level);
- HDstrcat(strfilter,temp);
- }
+ {
+ unsigned level = cd_values[0];
+
+ sprintf(temp,"(%d)", level);
+ HDstrcat(strfilter, temp);
+ }
#endif
- break;
+ break;
- case H5Z_FILTER_SZIP:
- HDstrcat(strfilter, "SZIP ");
+ case H5Z_FILTER_SZIP:
+ HDstrcat(strfilter, "SZIP ");
#if defined (PRINT_DEBUG)
- {
- unsigned options_mask=cd_values[0]; /* from dcpl, not filt*/
- unsigned ppb=cd_values[1];
- sprintf(temp,"(%d,",ppb);
- HDstrcat(strfilter,temp);
- if (options_mask & H5_SZIP_EC_OPTION_MASK)
- HDstrcpy(temp,"EC) ");
- else if (options_mask & H5_SZIP_NN_OPTION_MASK)
- HDstrcpy(temp,"NN) ");
- }
- HDstrcat(strfilter,temp);
-
+ {
+ unsigned options_mask = cd_values[0]; /* from dcpl, not filt*/
+ unsigned ppb = cd_values[1];
+
+ sprintf(temp,"(%d,", ppb);
+ HDstrcat(strfilter, temp);
+ if (options_mask & H5_SZIP_EC_OPTION_MASK)
+ HDstrcpy(temp, "EC) ");
+ else if (options_mask & H5_SZIP_NN_OPTION_MASK)
+ HDstrcpy(temp, "NN) ");
+ }
+ HDstrcat(strfilter, temp);
#endif
+ break;
- break;
-
- case H5Z_FILTER_SHUFFLE:
- HDstrcat(strfilter, "SHUF ");
- break;
-
- case H5Z_FILTER_FLETCHER32:
- HDstrcat(strfilter, "FLET ");
- break;
-
- case H5Z_FILTER_NBIT:
- HDstrcat(strfilter, "NBIT ");
- break;
-
- case H5Z_FILTER_SCALEOFFSET:
- HDstrcat(strfilter, "SCALEOFFSET ");
- break;
-
- default:
- HDstrcat(strfilter, "UD ");
- break;
- } /* switch */
- }/*i*/
-
- if (!pr)
- printf(FORMAT_OBJ, "dset", objname);
- else {
- char str[255], temp[28];
- HDstrcpy(str, "dset ");
- HDstrcat(str, strfilter);
- sprintf(temp, " (%.3f:1)", ratio);
- HDstrcat(str, temp);
- printf(FORMAT_OBJ, str, objname);
- }
+ case H5Z_FILTER_SHUFFLE:
+ HDstrcat(strfilter, "SHUF ");
+ break;
+
+ case H5Z_FILTER_FLETCHER32:
+ HDstrcat(strfilter, "FLET ");
+ break;
+
+ case H5Z_FILTER_NBIT:
+ HDstrcat(strfilter, "NBIT ");
+ break;
+
+ case H5Z_FILTER_SCALEOFFSET:
+ HDstrcat(strfilter, "SCALEOFFSET ");
+ break;
+
+ default:
+ HDstrcat(strfilter, "UD ");
+ break;
+ } /* switch */
+ }/*i*/
+
+ if (!pr)
+ printf(FORMAT_OBJ, "dset", objname);
+ else {
+ char str[255], temp[28];
+
+ HDstrcpy(str, "dset ");
+ HDstrcat(str, strfilter);
+ sprintf(temp, " (%.3f:1)", ratio);
+ HDstrcat(str, temp);
+ printf(FORMAT_OBJ, str, objname);
+ }
}
/*-------------------------------------------------------------------------
@@ -1522,74 +1436,66 @@ static void print_dataset_info(hid_t dcpl_id, char *objname, double ratio,
*-------------------------------------------------------------------------
*/
static int copy_user_block(const char *infile, const char *outfile,
- hsize_t size) {
+ hsize_t size)
+{
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
int infid = -1, outfid = -1; /* File descriptors */
- int status = 0; /* Return value */
-
- /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */
- HDassert(size > 0);
-
- /* Open files */
- if ((infid = HDopen(infile, O_RDONLY, 0)) < 0) {
- status = -1;
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed");
- }
- if ((outfid = HDopen(outfile, O_WRONLY, 0644)) < 0) {
- status = -1;
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed");
- }
-
- /* Copy the userblock from the input file to the output file */
- while (size > 0) {
- ssize_t nread, nbytes; /* # of bytes transfered, etc. */
- char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */
- const char *wbuf; /* Pointer into buffer, for writing */
-
- /* Read buffer from source file */
- if (size > USERBLOCK_XFER_SIZE)
- nread = HDread(infid, rbuf, (size_t)USERBLOCK_XFER_SIZE);
- else
- nread = HDread(infid, rbuf, (size_t)size);
- if (nread < 0) {
- status = -1;
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDread failed");
- } /* end if */
-
- /* Write buffer to destination file */
- /* (compensating for interrupted writes & checking for errors, etc.) */
- nbytes = nread;
- wbuf = rbuf;
- while (nbytes > 0) {
- ssize_t nwritten; /* # of bytes written */
-
- do {
- nwritten = HDwrite(outfid, wbuf, (size_t)nbytes);
- } while (-1 == nwritten && EINTR == errno);
- if (-1 == nwritten) { /* error */
- status = -1;
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDwrite failed");
- } /* end if */
- HDassert(nwritten > 0);
- HDassert(nwritten <= nbytes);
-
- /* Update # of bytes left & offset in buffer */
- nbytes -= nwritten;
- wbuf += nwritten;
- HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE));
- } /* end while */
- /* Update size of userblock left to transfer */
- size = size - (hsize_t) nread;
- } /* end while */
+ /* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */
+ HDassert(size > 0);
+
+ /* Open files */
+ if ((infid = HDopen(infile, O_RDONLY, 0)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed");
+ if ((outfid = HDopen(outfile, O_WRONLY, 0644)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed");
+
+ /* Copy the userblock from the input file to the output file */
+ while (size > 0) {
+ ssize_t nread, nbytes; /* # of bytes transfered, etc. */
+ char rbuf[USERBLOCK_XFER_SIZE]; /* Buffer for reading */
+ const char *wbuf; /* Pointer into buffer, for writing */
+
+ /* Read buffer from source file */
+ if (size > USERBLOCK_XFER_SIZE)
+ nread = HDread(infid, rbuf, (size_t)USERBLOCK_XFER_SIZE);
+ else
+ nread = HDread(infid, rbuf, (size_t)size);
+ if (nread < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDread failed");
+
+ /* Write buffer to destination file */
+ /* (compensating for interrupted writes & checking for errors, etc.) */
+ nbytes = nread;
+ wbuf = rbuf;
+ while (nbytes > 0) {
+ ssize_t nwritten; /* # of bytes written */
+
+ do {
+ nwritten = HDwrite(outfid, wbuf, (size_t)nbytes);
+ } while (-1 == nwritten && EINTR == errno);
+ if (-1 == nwritten) /* error */
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDwrite failed");
+ HDassert(nwritten > 0);
+ HDassert(nwritten <= nbytes);
+
+ /* Update # of bytes left & offset in buffer */
+ nbytes -= nwritten;
+ wbuf += nwritten;
+ HDassert(nbytes == 0 || wbuf < (rbuf + USERBLOCK_XFER_SIZE));
+ } /* end while */
+
+ /* Update size of userblock left to transfer */
+ size = size - (hsize_t) nread;
+ } /* end while */
done:
- if (infid > 0)
- HDclose(infid);
- if (outfid > 0)
- HDclose(outfid);
+ if (infid > 0)
+ HDclose(infid);
+ if (outfid > 0)
+ HDclose(outfid);
- return status;
+ return ret_value;
}
/*-------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index b2755c2..f0f32c3 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -1,4 +1,3 @@
-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
@@ -86,18 +85,18 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
if((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gopen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gopen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
if(copy_refs_attr(grp_in, grp_out, options, travt, fidout) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_refs_attr failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed");
if(H5Gclose(grp_out) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
if(H5Gclose(grp_in) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
/*-------------------------------------------------------------------------
* check for hard links
@@ -114,26 +113,26 @@ int do_copy_refobjs(hid_t fidin,
*/
case H5TRAV_TYPE_DATASET:
if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
if((space_id = H5Dget_space(dset_in)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_space failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
if((ftype_id = H5Dget_type(dset_in)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_type failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
if((dcpl_id = H5Dget_create_plist(dset_in)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
if((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
nelmts = 1;
for(k = 0; k < rank; k++)
nelmts *= dims[k];
if((mtype_id = h5tools_get_native_type(ftype_id)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_get_native_type failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_get_native_type failed");
if((msize = H5Tget_size(mtype_id)) == 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_size failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
/*-------------------------------------------------------------------------
* check if the dataset creation property list has filters that
@@ -169,15 +168,15 @@ int do_copy_refobjs(hid_t fidin,
buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize));
if(buf==NULL) {
printf("cannot read into memory\n" );
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
} /* end if */
if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
refbuf = (hobj_ref_t*) HDcalloc((unsigned)nelmts, msize);
if(refbuf == NULL){
printf("cannot allocate memory\n" );
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDcalloc failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed");
} /* end if */
for(u = 0; u < nelmts; u++) {
H5E_BEGIN_TRY {
@@ -191,7 +190,7 @@ int do_copy_refobjs(hid_t fidin,
if((refname = MapIdToName(refobj_id, travt)) != NULL) {
/* create the reference, -1 parameter for objects */
if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rcreate failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed");
if(options->verbose)
{
printf(FORMAT_OBJ,"dset",travt->objs[i].name );
@@ -209,10 +208,10 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed");
if(nelmts)
if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dwrite failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed");
if(buf)
HDfree(buf);
@@ -223,7 +222,7 @@ int do_copy_refobjs(hid_t fidin,
* copy attrs
*----------------------------------------------------*/
if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_attr failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
} /*H5T_STD_REF_OBJ*/
/*-------------------------------------------------------------------------
@@ -246,10 +245,10 @@ int do_copy_refobjs(hid_t fidin,
buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize));
if(buf == NULL) {
printf("cannot read into memory\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
} /* end if */
if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
/*-------------------------------------------------------------------------
* create output
@@ -258,7 +257,7 @@ int do_copy_refobjs(hid_t fidin,
refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
if(refbuf == NULL) {
printf("cannot allocate memory\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDcalloc failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed");
} /* end if */
for(u = 0; u < nelmts; u++) {
@@ -274,18 +273,15 @@ int do_copy_refobjs(hid_t fidin,
hid_t region_id; /* region id of the referenced dataset */
if((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed");
/* create the reference, we need the space_id */
if(H5Rcreate(&refbuf[u], fidout, refname, H5R_DATASET_REGION, region_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rcreate failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed");
if(H5Sclose(region_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
if(options->verbose)
{
-
-
-
printf(FORMAT_OBJ,"dset",travt->objs[i].name );
printf("object <%s> region reference created to <%s>\n",
travt->objs[i].name,
@@ -301,10 +297,10 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed");
if(nelmts)
if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dwrite failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed");
if(buf)
HDfree(buf);
@@ -315,7 +311,7 @@ int do_copy_refobjs(hid_t fidin,
* copy attrs
*----------------------------------------------------*/
if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_attr failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed");
} /* H5T_STD_REF_DSETREG */
/*-------------------------------------------------------------------------
* not references, open previously created object in 1st traversal
@@ -323,7 +319,7 @@ int do_copy_refobjs(hid_t fidin,
*/
else {
if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
} /* end else */
HDassert(dset_out != FAIL);
@@ -333,7 +329,7 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
if(copy_refs_attr(dset_in, dset_out, options, travt, fidout) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "copy_refs_attr failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed");
/*-------------------------------------------------------------------------
* check for hard links
@@ -344,7 +340,7 @@ int do_copy_refobjs(hid_t fidin,
H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT);
if(H5Dclose(dset_out) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
} /*can_read*/
/*-------------------------------------------------------------------------
@@ -352,15 +348,15 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
if(H5Tclose(ftype_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Tclose(mtype_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Pclose(dcpl_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
if(H5Sclose(space_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
if(H5Dclose(dset_in) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
break;
/*-------------------------------------------------------------------------
@@ -369,9 +365,9 @@ int do_copy_refobjs(hid_t fidin,
*/
case H5TRAV_TYPE_NAMED_DATATYPE:
if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Topen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed");
if(H5Tclose(type_in) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
break;
/*-------------------------------------------------------------------------
@@ -384,7 +380,7 @@ int do_copy_refobjs(hid_t fidin,
case H5TRAV_TYPE_UNKNOWN:
case H5TRAV_TYPE_UDLINK:
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5TRAV invalid type");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5TRAV invalid type");
default:
break;
@@ -397,7 +393,7 @@ int do_copy_refobjs(hid_t fidin,
*/
named_datatype_free(&named_dt_head, 0);
- return 0;
+ return ret_value;
done:
H5E_BEGIN_TRY {
@@ -413,7 +409,7 @@ done:
named_datatype_free(&named_dt_head, 0);
} H5E_END_TRY;
- return -1;
+ return ret_value;
}
@@ -469,32 +465,32 @@ static int copy_refs_attr(hid_t loc_in,
void *refbuf = NULL;
void *buf = NULL;
const char* refname = NULL;
- int *ref_comp_index = NULL;
+ unsigned *ref_comp_index = NULL;
size_t *ref_comp_size = NULL;
int ref_comp_field_n = 0;
if(H5Oget_info(loc_in, &oinfo) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Oget_info failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed");
for(u = 0; u < (unsigned)oinfo.num_attrs; u++) {
is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0;
/* open attribute */
if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aopen_by_idx failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed");
/* get the file datatype */
if((ftype_id = H5Aget_type(attr_id)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aget_type failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed");
type_class = H5Tget_class(ftype_id);
if((mtype_id = h5tools_get_native_type(ftype_id)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_get_native_type failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_get_native_type failed");
if((msize = H5Tget_size(mtype_id)) == 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_size failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
is_ref = (type_class == H5T_REFERENCE);
@@ -518,10 +514,10 @@ static int copy_refs_attr(hid_t loc_in,
int nmembers = H5Tget_nmembers(ftype_id) ;
if (nmembers < 1)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_nmembers failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed");
- ref_comp_index = (int *)HDmalloc(nmembers*sizeof (int));
- ref_comp_size = (size_t *)HDmalloc(nmembers*sizeof(ref_comp_size));
+ ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers*sizeof(unsigned));
+ ref_comp_size = (size_t *)HDmalloc((size_t)nmembers*sizeof(ref_comp_size));
ref_comp_field_n = 0;
for (i=0; i<(unsigned)nmembers; i++) {
@@ -562,15 +558,15 @@ static int copy_refs_attr(hid_t loc_in,
/* get name */
if(H5Aget_name(attr_id, 255, name) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aget_name failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name failed");
/* get the dataspace handle */
if((space_id = H5Aget_space(attr_id)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aget_space failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space failed");
/* get dimensions */
if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
/*-------------------------------------------------------------------------
@@ -582,8 +578,8 @@ static int copy_refs_attr(hid_t loc_in,
nelmts *= dims[j];
if (is_ref_array) {
- unsigned array_rank = 0;
- hsize_t array_size = 1;
+ unsigned array_rank = 0;
+ hsize_t array_size = 1;
hsize_t array_dims[H5S_MAX_RANK];
hid_t base_type;
@@ -591,7 +587,7 @@ static int copy_refs_attr(hid_t loc_in,
msize = H5Tget_size(base_type);
H5Tclose(base_type);
- array_rank = H5Tget_array_ndims(mtype_id);
+ array_rank = (unsigned)H5Tget_array_ndims(mtype_id);
H5Tget_array_dims2(mtype_id, array_dims);
for(j = 0; j <array_rank; j++)
array_size *= array_dims[j];
@@ -599,7 +595,7 @@ static int copy_refs_attr(hid_t loc_in,
}
if((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Acreate2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed");
if (nelmts>0) {
/* handle object references */
@@ -607,15 +603,15 @@ static int copy_refs_attr(hid_t loc_in,
buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize));
if(buf == NULL) {
printf("cannot read into memory\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
} /* end if */
if(H5Aread(attr_id, mtype_id, buf) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aread failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed");
refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize);
if(refbuf == NULL) {
printf("cannot allocate memory\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDcalloc failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed");
} /* end if */
for(i = 0; i < (unsigned)nelmts; i++) {
@@ -631,10 +627,10 @@ static int copy_refs_attr(hid_t loc_in,
if(buf == NULL) {
printf( "cannot read into memory\n" );
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
} /* end if */
if(H5Aread(attr_id, mtype_id, buf) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aread failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed");
/*-------------------------------------------------------------------------
* create output
@@ -643,7 +639,7 @@ static int copy_refs_attr(hid_t loc_in,
refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */
if(refbuf == NULL) {
printf( "cannot allocate memory\n" );
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDcalloc failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed");
} /* end if */
for(i = 0; i < (unsigned)nelmts; i++) {
@@ -661,11 +657,11 @@ static int copy_refs_attr(hid_t loc_in,
if(buf == NULL) {
printf( "cannot read into memory\n" );
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
} /* end if */
if(H5Aread(attr_id, mtype_id, buf) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aread failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed");
if (H5R_OBJ_REF_BUF_SIZE==msize) {
hobj_ref_t ref_out;
@@ -702,41 +698,43 @@ static int copy_refs_attr(hid_t loc_in,
if(buf == NULL)
{
printf( "cannot read into memory\n" );
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDmalloc failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed");
} /* end if */
if(H5Aread(attr_id, mtype_id, buf) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aread failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed");
for (i=0; i<(unsigned)nelmts; i++) {
- for (j=0; j<(unsigned)ref_comp_field_n; j++) {
- if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) {
- int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]);
- hobj_ref_t ref_out;
- if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0)
- continue;
- HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]);
- } /* if */
- else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) {
- int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]);
- hdset_reg_ref_t ref_out;
- if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0)
- continue;
- HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]);
- } /* else if */
- } /* j */
+ for (j=0; j<(unsigned)ref_comp_field_n; j++) {
+ if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) {
+ size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]);
+ hobj_ref_t ref_out;
+
+ if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0)
+ continue;
+ HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]);
+ } /* if */
+ else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) {
+ size_t idx = i * msize + H5Tget_member_offset(mtype_id, ref_comp_index[j]);
+ hdset_reg_ref_t ref_out;
+
+ if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0)
+ continue;
+ HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]);
+ } /* else if */
+ } /* j */
} /* i */
} /* else if (is_ref_comp) */
if(H5Awrite(attr_out, mtype_id, refbuf) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Awrite failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed");
if (is_ref_vlen && buf)
H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf);
} /* if (nelmts) */
if (refbuf == buf)
- refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */
+ refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */
if(buf) {
HDfree(buf);
@@ -749,39 +747,39 @@ static int copy_refs_attr(hid_t loc_in,
}
if (ref_comp_index) {
- HDfree(ref_comp_index);
- ref_comp_index = NULL;
+ HDfree(ref_comp_index);
+ ref_comp_index = NULL;
}
if (ref_comp_size) {
- HDfree(ref_comp_size);
- ref_comp_size = NULL;
+ HDfree(ref_comp_size);
+ ref_comp_size = NULL;
}
if(H5Aclose(attr_out) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
if(H5Tclose(ftype_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Tclose(mtype_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Sclose(space_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
if(H5Aclose(attr_id) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
} /* for(u = 0; u < (unsigned)oinfo.num_attrs; u++) */
- return 0;
+ return ret_value;
done:
- if(refbuf)
- HDfree(refbuf);
- if(buf)
- HDfree(buf);
+ if(refbuf)
+ HDfree(refbuf);
+ if(buf)
+ HDfree(buf);
if (ref_comp_index)
HDfree(ref_comp_index);
@@ -797,7 +795,7 @@ done:
H5Aclose(attr_out);
} H5E_END_TRY;
- return -1;
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -848,30 +846,25 @@ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
hid_t fid_out, void *ref_out, trav_table_t *travt)
{
int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */
- herr_t ret = -1;
- const char* ref_obj_name;
- hid_t space_id=-1, ref_obj_id=-1;
+ const char* ref_obj_name;
+ hid_t space_id=-1, ref_obj_id=-1;
ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in);
- if (ref_obj_id<0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference2 failed");
+ if (ref_obj_id < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rdereference2 failed");
- ref_obj_name = MapIdToName(ref_obj_id, travt);
- if (ref_obj_name == NULL)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "MapIdToName failed");
+ ref_obj_name = MapIdToName(ref_obj_id, travt);
+ if (ref_obj_name == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "MapIdToName failed");
- if (ref_type == H5R_DATASET_REGION) {
- space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in);
- if (space_id < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region failed");
+ if (ref_type == H5R_DATASET_REGION) {
+ space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in);
+ if (space_id < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed");
}
- ret = H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id);
-
- if (ret < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rcreate failed");
-
- ret = 0;
+ if(H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed");
done:
H5E_BEGIN_TRY {
@@ -879,6 +872,6 @@ done:
H5Oclose(ref_obj_id);
} H5E_END_TRY;
- return ret;
+ return ret_value;
}
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index 9565ce3..6765c49 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -80,20 +80,20 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*-------------------------------------------------------------------------
*/
if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
if((sid = H5Dget_space(did)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_space failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
if((pid = H5Dget_create_plist(did)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
if((tid = H5Dget_type(did)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_type failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
/*-------------------------------------------------------------------------
* filter check
*-------------------------------------------------------------------------
*/
if(verify_filters(pid, tid, obj->nfilters, obj->filter) <= 0)
- ok = 0;
+ ok = 0;
/*-------------------------------------------------------------------------
@@ -108,13 +108,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*-------------------------------------------------------------------------
*/
if(H5Pclose(pid) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
if (H5Sclose(sid) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
if (H5Dclose(did) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
if (H5Tclose(tid) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
}
@@ -132,7 +132,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
/* get the list of objects in the file */
if(h5trav_gettable(fidout, travt) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5trav_gettable failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
for(i = 0; i < travt->nobjs; i++)
{
@@ -146,13 +146,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*-------------------------------------------------------------------------
*/
if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
if((sid = H5Dget_space(did)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_space failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
if((pid = H5Dget_create_plist(did)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
if((tid = H5Dget_type(did)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_type failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed");
/*-------------------------------------------------------------------------
* filter check
@@ -160,7 +160,6 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*/
if(options->all_filter == 1)
{
-
if(verify_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0)
ok = 0;
}
@@ -172,6 +171,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
if(options->all_layout == 1)
{
pack_info_t pack;
+
init_packobject(&pack);
pack.layout = options->layout_g;
pack.chunk = options->chunk_g;
@@ -185,13 +185,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*-------------------------------------------------------------------------
*/
if (H5Pclose(pid) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
if (H5Sclose(sid) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
if (H5Dclose(did) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
if (H5Tclose(tid) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
} /* if */
} /* i */
@@ -208,31 +208,31 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
/* open the input file */
if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 )
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fopen failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed");
/* Get file creation property list for input file */
if((fcpl_in = H5Fget_create_plist(fidin)) < 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");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed");
}
/* Get file space management info for input file */
if(H5Pget_file_space(fcpl_in, &in_strat, &in_thresh) < 0) {
error_msg("failed to retrieve file space strategy & threshold\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_file_space failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed");
}
/* Output file is already opened */
/* Get file creation property list for output file */
if((fcpl_out = H5Fget_create_plist(fidout)) < 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");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed");
}
/* Get file space management info for output file */
if(H5Pget_file_space(fcpl_out, &out_strat, &out_thresh) < 0) {
error_msg("failed to retrieve file space strategy & threshold\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_file_space failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space failed");
}
/*
@@ -245,12 +245,12 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*/
if(!options->fs_strategy && out_strat != in_strat) {
error_msg("file space strategy not set as unexpected\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
}
else if(options->fs_strategy && out_strat!= options->fs_strategy) {
error_msg("file space strategy not set as unexpected\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "file space strategy not set as unexpected");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected");
}
/*
@@ -263,22 +263,22 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
*/
if(!options->fs_threshold && out_thresh != in_thresh) {
error_msg("free space threshold not set as unexpected\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "free space threshold not set as unexpected");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free space threshold not set as unexpected");
}
else if(options->fs_threshold && out_thresh != options->fs_threshold) {
error_msg("free space threshold not set as unexpected\n");
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "free space threshold not set as unexpected");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "free space threshold not set as unexpected");
}
/* Closing */
if (H5Pclose(fcpl_in) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
if (H5Pclose(fcpl_out) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
if (H5Fclose(fidin) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
if (H5Fclose(fidout) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
return ok;
@@ -294,7 +294,8 @@ done:
if (travt)
trav_table_free(travt);
} H5E_END_TRY;
- return -1;
+
+ return ret_value;
} /* h5repack_verify() */
@@ -397,12 +398,12 @@ int h5repack_cmp_pl(const char *fname1,
{
/* Open the files */
- if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
+ if ((fid1 = H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
{
error_msg("<%s>: %s\n", fname1, H5FOPENERROR );
return -1;
}
- if ((fid2=H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
+ if ((fid2 = H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
{
error_msg("<%s>: %s\n", fname2, H5FOPENERROR );
H5Fclose(fid1);
@@ -417,7 +418,7 @@ int h5repack_cmp_pl(const char *fname1,
*/
trav_table_init(&trav);
if(h5trav_gettable(fid1, trav) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5trav_gettable failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
/*-------------------------------------------------------------------------
* traverse the suppplied object list
@@ -430,30 +431,30 @@ int h5repack_cmp_pl(const char *fname1,
{
if ((gid = H5Gopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gopen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
if ((gcplid = H5Gget_create_plist(gid)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gget_create_plist failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed");
if (H5Pget_link_creation_order(gcplid, &crt_order_flag1) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
if (H5Pclose(gcplid) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
if (H5Gclose(gid) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
if ((gid = H5Gopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gopen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
if ((gcplid = H5Gget_create_plist(gid)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gget_create_plist failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed");
if (H5Pget_link_creation_order(gcplid, &crt_order_flag2) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed");
if (H5Pclose(gcplid) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
if (H5Gclose(gid) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Gclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
if (crt_order_flag1 != crt_order_flag2) {
error_msg("property lists for <%s> are different\n",trav->objs[i].name);
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "property lists failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed");
}
}
@@ -463,24 +464,24 @@ int h5repack_cmp_pl(const char *fname1,
else if(trav->objs[i].type == H5TRAV_TYPE_DATASET)
{
if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
if((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dopen2 failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed");
if((dcpl1 = H5Dget_create_plist(dset1)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
if((dcpl2 = H5Dget_create_plist(dset2)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dget_create_plist failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed");
/*-------------------------------------------------------------------------
* compare the property lists
*-------------------------------------------------------------------------
*/
if((ret = H5Pequal(dcpl1, dcpl2)) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pequal failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pequal failed");
if(ret == 0) {
error_msg("property lists for <%s> are different\n",trav->objs[i].name);
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "property lists failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "property lists failed");
}
/*-------------------------------------------------------------------------
@@ -488,13 +489,13 @@ int h5repack_cmp_pl(const char *fname1,
*-------------------------------------------------------------------------
*/
if(H5Pclose(dcpl1) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
if(H5Pclose(dcpl2) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
if(H5Dclose(dset1) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
if(H5Dclose(dset2) < 0)
- HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose failed");
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
} /*if*/
} /*i*/
@@ -512,13 +513,13 @@ int h5repack_cmp_pl(const char *fname1,
H5Fclose(fid1);
H5Fclose(fid2);
- return ret;
- /*-------------------------------------------------------------------------
- * error
- *-------------------------------------------------------------------------
- */
+ return ret;
+/*-------------------------------------------------------------------------
+* error
+*-------------------------------------------------------------------------
+*/
done:
H5E_BEGIN_TRY
{
@@ -532,8 +533,8 @@ done:
H5Gclose(gid);
trav_table_free(trav);
} H5E_END_TRY;
- return -1;
+ return ret_value;
}
@@ -602,100 +603,71 @@ int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter)
switch (filtn)
{
- case H5Z_FILTER_NONE:
+ case H5Z_FILTER_NONE:
break;
- case H5Z_FILTER_SHUFFLE:
-
- /* 1 private client value is returned by DCPL */
- if ( cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SHUFFLE_USER_NPARMS )
- return 0;
-
- /* get dataset's type size */
- if((size = H5Tget_size(tid)) <= 0)
- return -1;
-
- /* the private client value holds the dataset's type size */
- if ( size != cd_values[0] )
- return 0;
-
-
- break;
-
- case H5Z_FILTER_SZIP:
-
- /* 4 private client values are returned by DCPL */
- if ( cd_nelmts != H5Z_SZIP_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SZIP_USER_NPARMS )
- return 0;
-
- /* "User" parameter for pixels-per-block (index 1) */
- if ( cd_values[H5Z_SZIP_PARM_PPB] != filter[i].cd_values[H5Z_SZIP_PARM_PPB] )
- return 0;
-
-
- break;
-
- case H5Z_FILTER_NBIT:
-
- /* only client data values number of values checked */
- if ( H5Z_NBIT_USER_NPARMS != filter[i].cd_nelmts)
- return 0;
-
-
-
- break;
+ case H5Z_FILTER_SHUFFLE:
+ /* 1 private client value is returned by DCPL */
+ if ( cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SHUFFLE_USER_NPARMS )
+ return 0;
- case H5Z_FILTER_SCALEOFFSET:
+ /* get dataset's type size */
+ if((size = H5Tget_size(tid)) <= 0)
+ return -1;
- /* only client data values checked */
- for( j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++)
- {
- if (cd_values[j] != filter[i].cd_values[j])
- {
+ /* the private client value holds the dataset's type size */
+ if ( size != cd_values[0] )
return 0;
- }
- }
+ break;
+ case H5Z_FILTER_SZIP:
+ /* 4 private client values are returned by DCPL */
+ if ( cd_nelmts != H5Z_SZIP_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SZIP_USER_NPARMS )
+ return 0;
- break;
-
- /* for these filters values must match, no local values set in DCPL */
- case H5Z_FILTER_FLETCHER32:
- case H5Z_FILTER_DEFLATE:
+ /* "User" parameter for pixels-per-block (index 1) */
+ if ( cd_values[H5Z_SZIP_PARM_PPB] != filter[i].cd_values[H5Z_SZIP_PARM_PPB] )
+ return 0;
- if ( cd_nelmts != filter[i].cd_nelmts)
- return 0;
+ break;
- for( j = 0; j < cd_nelmts; j++)
- {
- if (cd_values[j] != filter[i].cd_values[j])
- {
+ case H5Z_FILTER_NBIT:
+ /* only client data values number of values checked */
+ if ( H5Z_NBIT_USER_NPARMS != filter[i].cd_nelmts)
return 0;
- }
+ break;
- }
+ case H5Z_FILTER_SCALEOFFSET:
+ /* only client data values checked */
+ for( j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++)
+ if (cd_values[j] != filter[i].cd_values[j])
+ return 0;
+ break;
+ /* for these filters values must match, no local values set in DCPL */
+ case H5Z_FILTER_FLETCHER32:
+ case H5Z_FILTER_DEFLATE:
+ if ( cd_nelmts != filter[i].cd_nelmts)
+ return 0;
- break;
+ for( j = 0; j < cd_nelmts; j++)
+ if (cd_values[j] != filter[i].cd_values[j])
+ return 0;
- default:
- if ( cd_nelmts != filter[i].cd_nelmts)
- return 0;
+ break;
- for( j = 0; j < cd_nelmts; j++)
- {
- if (cd_values[j] != filter[i].cd_values[j])
- {
- return 0;
- }
+ default:
+ if ( cd_nelmts != filter[i].cd_nelmts)
+ return 0;
- }
- break;
+ for( j = 0; j < cd_nelmts; j++)
+ if (cd_values[j] != filter[i].cd_values[j])
+ return 0;
+ break;
} /* switch */
-
}
return 1;
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index b1637a8..79dc51f 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -30,7 +30,8 @@
* 2) when diff was found (normal mode)
*-------------------------------------------------------------------------
*/
-int print_objname (diff_opt_t * options, hsize_t nfound)
+H5_ATTR_PURE int
+print_objname (diff_opt_t * options, hsize_t nfound)
{
return ((options->m_verbose || nfound) && !options->m_quiet) ? 1 : 0;
}
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index d592528..7897e49 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -106,9 +106,9 @@ static hbool_t not_comparable;
per = -1; \
not_comparable = FALSE; \
both_zero = FALSE; \
- if(H5_DBL_ABS_EQUAL(0,A) && H5_DBL_ABS_EQUAL(0,B)) \
+ if(H5_DBL_ABS_EQUAL(0, (double)A) && H5_DBL_ABS_EQUAL(0, (double)B)) \
both_zero = TRUE; \
- if(!H5_DBL_ABS_EQUAL(0,A)) \
+ if(!H5_DBL_ABS_EQUAL(0, (double)A)) \
per = (double)ABS((double)((B) - (A)) / (double)(A)); \
else \
not_comparable = TRUE; \
@@ -119,9 +119,9 @@ static hbool_t not_comparable;
per = -1; \
not_comparable = FALSE; \
both_zero = FALSE; \
- if(H5_DBL_ABS_EQUAL(0,A) && H5_DBL_ABS_EQUAL(0,B)) \
+ if(H5_DBL_ABS_EQUAL(0, (double)A) && H5_DBL_ABS_EQUAL(0, (double)B)) \
both_zero = TRUE; \
- if(!H5_DBL_ABS_EQUAL(0,A)) \
+ if(!H5_DBL_ABS_EQUAL(0, (double)A)) \
per = ABS((double)((TYPE)((B) - (A))) / (double)(A)) ; \
else \
not_comparable = TRUE; \
@@ -597,7 +597,6 @@ static hsize_t diff_datum(void *_mem1,
hid_t obj2_id;
hsize_t nfound=0; /* differences found */
int ret=0; /* check return error */
- float f1, f2;
double per;
hbool_t both_zero;
@@ -1856,210 +1855,6 @@ static hsize_t diff_datum(void *_mem1,
} /*H5T_NATIVE_ULONG*/
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_LLONG
- *-------------------------------------------------------------------------
- */
-
- else if (type_size==8 && type_sign!=H5T_SGN_NONE)
- {
- long long temp1_llong;
- long long temp2_llong;
- HDassert(type_size==sizeof(long long));
-
- HDmemcpy(&temp1_llong, mem1, sizeof(long long));
- HDmemcpy(&temp2_llong, mem2, sizeof(long long));
- /* -d and !-p */
- if (options->d && !options->p)
- {
- if (ABS(temp1_llong-temp2_llong) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!options->d && options->p)
- {
- PER(temp1_llong,temp2_llong);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per);
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if ( options->d && options->p)
- {
- PER(temp1_llong,temp2_llong);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per);
- }
- nfound++;
- }
- }
- else if (temp1_llong != temp2_llong)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
- }
- nfound++;
- }
-
- } /*H5T_NATIVE_LLONG*/
-
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_ULLONG
- *-------------------------------------------------------------------------
- */
-
- else if (type_size==8 && type_sign==H5T_SGN_NONE)
- {
- unsigned long long temp1_ullong;
- unsigned long long temp2_ullong;
- HDassert(type_size==sizeof(unsigned long long));
-
- HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
- HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
- /* -d and !-p */
- if (options->d && !options->p)
- {
- if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!options->d && options->p)
- {
- ull2float(temp1_ullong,&f1);
- ull2float(temp2_ullong,&f2);
- PER(f1,f2);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent )
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if ( options->d && options->p)
- {
- ull2float(temp1_ullong,&f1);
- ull2float(temp2_ullong,&f2);
- PER(f1,f2);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta )
- {
-
- if ( print_data(options) )
- {
- print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2);
-
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
- }
- nfound++;
- }
- }
- else if (temp1_ullong != temp2_ullong)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
- }
- nfound++;
- }
-
- } /*H5T_NATIVE_ULLONG*/
-
-
break; /* H5T_INTEGER class */
@@ -2495,7 +2290,7 @@ static hsize_t diff_datum(void *_mem1,
}
} /*H5T_NATIVE_DOUBLE*/
-#if H5_SIZEOF_LONG_DOUBLE !=0
+#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
/*-------------------------------------------------------------------------
@@ -2503,7 +2298,7 @@ static hsize_t diff_datum(void *_mem1,
*-------------------------------------------------------------------------
*/
- else if (type_size==8)
+ else if (type_size == H5_SIZEOF_LONG_DOUBLE)
{
long double temp1_double;
long double temp2_double;
@@ -2511,7 +2306,7 @@ static hsize_t diff_datum(void *_mem1,
hbool_t isnan2 = FALSE;
- HDassert(type_size==sizeof(long double));
+ HDassert(type_size == sizeof(long double));
HDmemcpy(&temp1_double, mem1, sizeof(long double));
HDmemcpy(&temp2_double, mem2, sizeof(long double));
@@ -2706,9 +2501,7 @@ static hsize_t diff_datum(void *_mem1,
}
nfound++;
}
- } /*H5T_NATIVE_DOUBLE*/
-
-
+ } /*H5T_NATIVE_LDOUBLE*/
#endif /* H5_SIZEOF_LONG_DOUBLE */
@@ -3986,158 +3779,153 @@ static hsize_t diff_schar(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- char temp1_char;
- char temp2_char;
- hsize_t i;
- double per;
- hbool_t both_zero;
-
- h5difftrace("diff_schar start\n");
-
- /* -d and !-p */
- if (options->d && !options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_char, mem1, sizeof(char));
- HDmemcpy(&temp2_char, mem2, sizeof(char));
-
- if (ABS(temp1_char-temp2_char) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char));
- }
- nfound++;
- }
- mem1+=sizeof(char);
- mem2+=sizeof(char);
- if (options->n && nfound>=options->count)
- return nfound;
- }
- }
-
- /* !-d and -p */
- else if (!options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_char, mem1, sizeof(char));
- HDmemcpy(&temp2_char, mem2, sizeof(char));
-
- PER(temp1_char,temp2_char);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,
- ABS(temp1_char-temp2_char));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_char,temp2_char,
- ABS(temp1_char-temp2_char),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(char);
- mem2+=sizeof(char);
- if (options->n && nfound>=options->count)
- return nfound;
- }
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_char, mem1, sizeof(char));
- HDmemcpy(&temp2_char, mem2, sizeof(char));
-
- PER(temp1_char,temp2_char);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,
- ABS(temp1_char-temp2_char));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_char,temp2_char,
- ABS(temp1_char-temp2_char),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(char);
- mem2+=sizeof(char);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
- else
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_char, mem1, sizeof(char));
- HDmemcpy(&temp2_char, mem2, sizeof(char));
-
- if (temp1_char != temp2_char)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char));
- }
- nfound++;
- }
-
- mem1+=sizeof(char);
- mem2+=sizeof(char);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
- h5difftrace("diff_schar finish\n");
+ hsize_t nfound=0; /* number of differences found */
+ char temp1_char;
+ char temp2_char;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
- return nfound;
+ h5difftrace("diff_schar start\n");
+
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_char, mem1, sizeof(char));
+ HDmemcpy(&temp2_char, mem2, sizeof(char));
+
+ if (ABS(temp1_char-temp2_char) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char));
+ }
+ nfound++;
+ }
+ mem1+=sizeof(char);
+ mem2+=sizeof(char);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_char, mem1, sizeof(char));
+ HDmemcpy(&temp2_char, mem2, sizeof(char));
+
+ PER(temp1_char,temp2_char);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,
+ ABS(temp1_char-temp2_char));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P,temp1_char,temp2_char,
+ ABS(temp1_char-temp2_char),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(char);
+ mem2+=sizeof(char);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_char, mem1, sizeof(char));
+ HDmemcpy(&temp2_char, mem2, sizeof(char));
+
+ PER(temp1_char,temp2_char);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,
+ ABS(temp1_char-temp2_char));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P,temp1_char,temp2_char,
+ ABS(temp1_char-temp2_char),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(char);
+ mem2+=sizeof(char);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+
+ }
+ else
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_char, mem1, sizeof(char));
+ HDmemcpy(&temp2_char, mem2, sizeof(char));
+
+ if (temp1_char != temp2_char)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(char);
+ mem2+=sizeof(char);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+
+ }
+ h5difftrace("diff_schar finish\n");
+
+ return nfound;
}
@@ -4165,159 +3953,149 @@ static hsize_t diff_uchar(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- unsigned char temp1_uchar;
- unsigned char temp2_uchar;
- hsize_t i;
- double per;
- hbool_t both_zero;
-
- h5difftrace("diff_uchar start\n");
-
- /* -d and !-p */
- if (options->d && !options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
-
- if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned char);
- mem2+=sizeof(unsigned char);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
-
- /* !-d and -p */
- else if (!options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
-
- PER_UNSIGN(signed char,temp1_uchar,temp2_uchar);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,
- PDIFF(temp1_uchar,temp2_uchar));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,
- PDIFF(temp1_uchar,temp2_uchar),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(unsigned char);
- mem2+=sizeof(unsigned char);
- if (options->n && nfound>=options->count)
- return nfound;
- }
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
-
- PER_UNSIGN(signed char,temp1_uchar,temp2_uchar);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,
- PDIFF(temp1_uchar,temp2_uchar));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,
- PDIFF(temp1_uchar,temp2_uchar),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(unsigned char);
- mem2+=sizeof(unsigned char);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
- else
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
-
- if (temp1_uchar != temp2_uchar)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar));
- }
- nfound++;
- }
-
- mem1+=sizeof(unsigned char);
- mem2+=sizeof(unsigned char);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
- h5difftrace("diff_uchar finish\n");
+ hsize_t nfound=0; /* number of differences found */
+ unsigned char temp1_uchar;
+ unsigned char temp2_uchar;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
- return nfound;
+ h5difftrace("diff_uchar start\n");
+
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
+ HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+
+ if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar));
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned char);
+ mem2+=sizeof(unsigned char);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
+ HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+
+ PER_UNSIGN(signed char,temp1_uchar,temp2_uchar);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,
+ PDIFF(temp1_uchar,temp2_uchar));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,
+ PDIFF(temp1_uchar,temp2_uchar),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned char);
+ mem2+=sizeof(unsigned char);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
+ HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+
+ PER_UNSIGN(signed char,temp1_uchar,temp2_uchar);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,
+ PDIFF(temp1_uchar,temp2_uchar));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar,
+ PDIFF(temp1_uchar,temp2_uchar),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned char);
+ mem2+=sizeof(unsigned char);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ else
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
+ HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+
+ if (temp1_uchar != temp2_uchar)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(unsigned char);
+ mem2+=sizeof(unsigned char);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+
+ }
+ h5difftrace("diff_uchar finish\n");
+
+ return nfound;
}
/*-------------------------------------------------------------------------
@@ -4343,160 +4121,147 @@ static hsize_t diff_short(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- short temp1_short;
- short temp2_short;
- hsize_t i;
- double per;
- hbool_t both_zero;
-
- h5difftrace("diff_short start\n");
- /* -d and !-p */
- if (options->d && !options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_short, mem1, sizeof(short));
- HDmemcpy(&temp2_short, mem2, sizeof(short));
-
- if (ABS(temp1_short-temp2_short) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short));
- }
- nfound++;
- }
- mem1+=sizeof(short);
- mem2+=sizeof(short);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
-
- /* !-d and -p */
- else if (!options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_short, mem1, sizeof(short));
- HDmemcpy(&temp2_short, mem2, sizeof(short));
-
- PER(temp1_short,temp2_short);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,
- ABS(temp1_short-temp2_short));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_short,temp2_short,
- ABS(temp1_short-temp2_short),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(short);
- mem2+=sizeof(short);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_short, mem1, sizeof(short));
- HDmemcpy(&temp2_short, mem2, sizeof(short));
-
- PER(temp1_short,temp2_short);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,
- ABS(temp1_short-temp2_short));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_short,temp2_short,
- ABS(temp1_short-temp2_short),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(short);
- mem2+=sizeof(short);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
- else
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_short, mem1, sizeof(short));
- HDmemcpy(&temp2_short, mem2, sizeof(short));
-
- if (temp1_short != temp2_short)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short));
- }
- nfound++;
- }
-
- mem1+=sizeof(short);
- mem2+=sizeof(short);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
- h5difftrace("diff_short finish\n");
+ hsize_t nfound=0; /* number of differences found */
+ short temp1_short;
+ short temp2_short;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
- return nfound;
+ h5difftrace("diff_short start\n");
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_short, mem1, sizeof(short));
+ HDmemcpy(&temp2_short, mem2, sizeof(short));
+
+ if (ABS(temp1_short-temp2_short) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short));
+ }
+ nfound++;
+ }
+ mem1+=sizeof(short);
+ mem2+=sizeof(short);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_short, mem1, sizeof(short));
+ HDmemcpy(&temp2_short, mem2, sizeof(short));
+
+ PER(temp1_short,temp2_short);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,
+ ABS(temp1_short-temp2_short));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P,temp1_short,temp2_short,
+ ABS(temp1_short-temp2_short),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(short);
+ mem2+=sizeof(short);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_short, mem1, sizeof(short));
+ HDmemcpy(&temp2_short, mem2, sizeof(short));
+
+ PER(temp1_short,temp2_short);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,
+ ABS(temp1_short-temp2_short));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P,temp1_short,temp2_short,
+ ABS(temp1_short-temp2_short),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(short);
+ mem2+=sizeof(short);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ else
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_short, mem1, sizeof(short));
+ HDmemcpy(&temp2_short, mem2, sizeof(short));
+
+ if (temp1_short != temp2_short)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(short);
+ mem2+=sizeof(short);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+ }
+ h5difftrace("diff_short finish\n");
+
+ return nfound;
}
@@ -4523,162 +4288,147 @@ static hsize_t diff_ushort(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- unsigned short temp1_ushort;
- unsigned short temp2_ushort;
- hsize_t i;
- double per;
- hbool_t both_zero;
-
- h5difftrace("diff_ushort start\n");
- /* -d and !-p */
- if (options->d && !options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
- HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
-
- if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned short);
- mem2+=sizeof(unsigned short);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
-
- /* !-d and -p */
- else if (!options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
- HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
-
- PER_UNSIGN(signed short,temp1_ushort,temp2_ushort);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort,
- PDIFF(temp1_ushort,temp2_ushort));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort,
- PDIFF(temp1_ushort,temp2_ushort),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(unsigned short);
- mem2+=sizeof(unsigned short);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
- HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
-
- PER_UNSIGN(signed short,temp1_ushort,temp2_ushort);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort,
- PDIFF(temp1_ushort,temp2_ushort));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort,
- PDIFF(temp1_ushort,temp2_ushort),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(unsigned short);
- mem2+=sizeof(unsigned short);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
- else
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
- HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
-
- if (temp1_ushort != temp2_ushort)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort));
- }
- nfound++;
- }
-
- mem1+=sizeof(unsigned short);
- mem2+=sizeof(unsigned short);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
- h5difftrace("diff_ushort finish\n");
+ hsize_t nfound=0; /* number of differences found */
+ unsigned short temp1_ushort;
+ unsigned short temp2_ushort;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
+
+ h5difftrace("diff_ushort start\n");
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
+ HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
- return nfound;
-}
+ if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort));
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned short);
+ mem2+=sizeof(unsigned short);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
+ HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
+
+ PER_UNSIGN(signed short,temp1_ushort,temp2_ushort);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort,
+ PDIFF(temp1_ushort,temp2_ushort));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort,
+ PDIFF(temp1_ushort,temp2_ushort),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned short);
+ mem2+=sizeof(unsigned short);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
+ HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
+
+ PER_UNSIGN(signed short,temp1_ushort,temp2_ushort);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort,
+ PDIFF(temp1_ushort,temp2_ushort));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort,
+ PDIFF(temp1_ushort,temp2_ushort),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned short);
+ mem2+=sizeof(unsigned short);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ else
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
+ HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
+ if (temp1_ushort != temp2_ushort)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(unsigned short);
+ mem2+=sizeof(unsigned short);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+
+ }
+ h5difftrace("diff_ushort finish\n");
+
+ return nfound;
+}
/*-------------------------------------------------------------------------
@@ -4704,162 +4454,147 @@ static hsize_t diff_int(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- int temp1_int;
- int temp2_int;
- hsize_t i;
- double per;
- hbool_t both_zero;
-
- h5difftrace("diff_int start\n");
- /* -d and !-p */
- if (options->d && !options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_int, mem1, sizeof(int));
- HDmemcpy(&temp2_int, mem2, sizeof(int));
-
- if (ABS(temp1_int-temp2_int) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int));
- }
- nfound++;
- }
- mem1+=sizeof(int);
- mem2+=sizeof(int);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
-
- /* !-d and -p */
- else if (!options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_int, mem1, sizeof(int));
- HDmemcpy(&temp2_int, mem2, sizeof(int));
-
- PER(temp1_int,temp2_int);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,
- ABS(temp1_int-temp2_int));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_int,temp2_int,
- ABS(temp1_int-temp2_int),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(int);
- mem2+=sizeof(int);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_int, mem1, sizeof(int));
- HDmemcpy(&temp2_int, mem2, sizeof(int));
-
- PER(temp1_int,temp2_int);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,
- ABS(temp1_int-temp2_int));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_int,temp2_int,
- ABS(temp1_int-temp2_int),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(int);
- mem2+=sizeof(int);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
- else
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_int, mem1, sizeof(int));
- HDmemcpy(&temp2_int, mem2, sizeof(int));
-
- if (temp1_int != temp2_int)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int));
- }
- nfound++;
- }
-
- mem1+=sizeof(int);
- mem2+=sizeof(int);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
- h5difftrace("diff_int finish\n");
+ hsize_t nfound=0; /* number of differences found */
+ int temp1_int;
+ int temp2_int;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
- return nfound;
-}
+ h5difftrace("diff_int start\n");
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_int, mem1, sizeof(int));
+ HDmemcpy(&temp2_int, mem2, sizeof(int));
+
+ if (ABS(temp1_int-temp2_int) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int));
+ }
+ nfound++;
+ }
+ mem1+=sizeof(int);
+ mem2+=sizeof(int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_int, mem1, sizeof(int));
+ HDmemcpy(&temp2_int, mem2, sizeof(int));
+
+ PER(temp1_int,temp2_int);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,
+ ABS(temp1_int-temp2_int));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P,temp1_int,temp2_int,
+ ABS(temp1_int-temp2_int),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(int);
+ mem2+=sizeof(int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_int, mem1, sizeof(int));
+ HDmemcpy(&temp2_int, mem2, sizeof(int));
+
+ PER(temp1_int,temp2_int);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,
+ ABS(temp1_int-temp2_int));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P,temp1_int,temp2_int,
+ ABS(temp1_int-temp2_int),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(int);
+ mem2+=sizeof(int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ else
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_int, mem1, sizeof(int));
+ HDmemcpy(&temp2_int, mem2, sizeof(int));
+
+ if (temp1_int != temp2_int)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(int);
+ mem2+=sizeof(int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+ }
+ h5difftrace("diff_int finish\n");
+
+ return nfound;
+}
/*-------------------------------------------------------------------------
@@ -4885,160 +4620,144 @@ static hsize_t diff_uint(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- unsigned int temp1_uint;
- unsigned int temp2_uint;
- hsize_t i;
- double per;
- hbool_t both_zero;
-
- h5difftrace("diff_uint start\n");
- /* -d and !-p */
- if (options->d && !options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
- HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
-
- if ( PDIFF(temp1_uint,temp2_uint) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned int);
- mem2+=sizeof(unsigned int);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
-
- /* !-d and -p */
- else if (!options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
- HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
-
- PER_UNSIGN(signed int,temp1_uint,temp2_uint);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uint,temp2_uint,
- PDIFF(temp1_uint,temp2_uint),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(unsigned int);
- mem2+=sizeof(unsigned int);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
- HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
-
- PER_UNSIGN(signed int,temp1_uint,temp2_uint);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P,temp1_uint,temp2_uint,
- PDIFF(temp1_uint,temp2_uint),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(unsigned int);
- mem2+=sizeof(unsigned int);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
- else
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
- HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
-
- if (temp1_uint != temp2_uint)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
- }
- nfound++;
- }
-
- mem1+=sizeof(unsigned int);
- mem2+=sizeof(unsigned int);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
- h5difftrace("diff_uint finish\n");
+ hsize_t nfound=0; /* number of differences found */
+ unsigned int temp1_uint;
+ unsigned int temp2_uint;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
+
+ h5difftrace("diff_uint start\n");
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
+ HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
- return nfound;
-}
+ if ( PDIFF(temp1_uint,temp2_uint) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned int);
+ mem2+=sizeof(unsigned int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
+ HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
+
+ PER_UNSIGN(signed int,temp1_uint,temp2_uint);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P,temp1_uint,temp2_uint,
+ PDIFF(temp1_uint,temp2_uint),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned int);
+ mem2+=sizeof(unsigned int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
+ HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
+ PER_UNSIGN(signed int,temp1_uint,temp2_uint);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT_P,temp1_uint,temp2_uint,
+ PDIFF(temp1_uint,temp2_uint),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned int);
+ mem2+=sizeof(unsigned int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ else
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
+ HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
+
+ if (temp1_uint != temp2_uint)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(unsigned int);
+ mem2+=sizeof(unsigned int);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+ }
+ h5difftrace("diff_uint finish\n");
+
+ return nfound;
+}
/*-------------------------------------------------------------------------
@@ -5064,166 +4783,150 @@ static hsize_t diff_long(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- long temp1_long;
- long temp2_long;
- hsize_t i;
- double per;
- hbool_t both_zero;
-
- h5difftrace("diff_long start\n");
- /* -d and !-p */
- if (options->d && !options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_long, mem1, sizeof(long));
- HDmemcpy(&temp2_long, mem2, sizeof(long));
-
- if (ABS(temp1_long-temp2_long) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long));
- }
- nfound++;
- }
- mem1+=sizeof(long);
- mem2+=sizeof(long);
- if (options->n && nfound>=options->count)
- return nfound;
- }
- }
- }
-
- /* !-d and -p */
- else if (!options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_long, mem1, sizeof(long));
- HDmemcpy(&temp2_long, mem2, sizeof(long));
-
- PER(temp1_long,temp2_long);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long,
- ABS(temp1_long-temp2_long));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P,temp1_long,temp2_long,
- ABS(temp1_long-temp2_long),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(long);
- mem2+=sizeof(long);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_long, mem1, sizeof(long));
- HDmemcpy(&temp2_long, mem2, sizeof(long));
-
- PER(temp1_long,temp2_long);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long,
- ABS(temp1_long-temp2_long));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P,temp1_long,temp2_long,
- ABS(temp1_long-temp2_long),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(long);
- mem2+=sizeof(long);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
- else
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_long, mem1, sizeof(long));
- HDmemcpy(&temp2_long, mem2, sizeof(long));
-
- if (temp1_long != temp2_long)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long));
- }
- nfound++;
- }
-
- mem1+=sizeof(long);
- mem2+=sizeof(long);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
- h5difftrace("diff_long finish\n");
+ hsize_t nfound=0; /* number of differences found */
+ long temp1_long;
+ long temp2_long;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
- return nfound;
-}
+ h5difftrace("diff_long start\n");
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_long, mem1, sizeof(long));
+ HDmemcpy(&temp2_long, mem2, sizeof(long));
+
+ if (ABS(temp1_long-temp2_long) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long));
+ }
+ nfound++;
+ }
+ mem1+=sizeof(long);
+ mem2+=sizeof(long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ }
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_long, mem1, sizeof(long));
+ HDmemcpy(&temp2_long, mem2, sizeof(long));
+
+ PER(temp1_long,temp2_long);
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long,
+ ABS(temp1_long-temp2_long));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT_P,temp1_long,temp2_long,
+ ABS(temp1_long-temp2_long),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(long);
+ mem2+=sizeof(long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_long, mem1, sizeof(long));
+ HDmemcpy(&temp2_long, mem2, sizeof(long));
+
+ PER(temp1_long,temp2_long);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long,
+ ABS(temp1_long-temp2_long));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT_P,temp1_long,temp2_long,
+ ABS(temp1_long-temp2_long),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(long);
+ mem2+=sizeof(long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ else
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_long, mem1, sizeof(long));
+ HDmemcpy(&temp2_long, mem2, sizeof(long));
+ if (temp1_long != temp2_long)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(long);
+ mem2+=sizeof(long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+
+ }
+ h5difftrace("diff_long finish\n");
+
+ return nfound;
+}
/*-------------------------------------------------------------------------
@@ -5249,166 +4952,148 @@ static hsize_t diff_ulong(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- unsigned long temp1_ulong;
- unsigned long temp2_ulong;
- hsize_t i;
- double per;
- hbool_t both_zero;
-
- h5difftrace("diff_ulong start\n");
-
- /* -d and !-p */
- if (options->d && !options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
- HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
-
- if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned long);
- mem2+=sizeof(unsigned long);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
-
- }
-
- /* !-d and -p */
- else if (!options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
- HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
-
- PER_UNSIGN(signed long,temp1_ulong,temp2_ulong);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong,
- PDIFF(temp1_ulong,temp2_ulong),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(unsigned long);
- mem2+=sizeof(unsigned long);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
- HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
-
- PER_UNSIGN(signed long,temp1_ulong,temp2_ulong);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong,
- PDIFF(temp1_ulong,temp2_ulong),
- per);
- }
- nfound++;
- }
- mem1+=sizeof(unsigned long);
- mem2+=sizeof(unsigned long);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
- else
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
- HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
-
- if (temp1_ulong != temp2_ulong)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
- }
- nfound++;
- }
-
- mem1+=sizeof(unsigned long);
- mem2+=sizeof(unsigned long);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
- h5difftrace("diff_ulong finish\n");
+ hsize_t nfound=0; /* number of differences found */
+ unsigned long temp1_ulong;
+ unsigned long temp2_ulong;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
- return nfound;
-}
+ h5difftrace("diff_ulong start\n");
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
+ HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
+
+ if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned long);
+ mem2+=sizeof(unsigned long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ }
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
+ HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
+
+ PER_UNSIGN(signed long,temp1_ulong,temp2_ulong);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong,
+ PDIFF(temp1_ulong,temp2_ulong),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned long);
+ mem2+=sizeof(unsigned long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
+ HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
+
+ PER_UNSIGN(signed long,temp1_ulong,temp2_ulong);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong,
+ PDIFF(temp1_ulong,temp2_ulong),
+ per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned long);
+ mem2+=sizeof(unsigned long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ else
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
+ HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
+
+ if (temp1_ulong != temp2_ulong)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(unsigned long);
+ mem2+=sizeof(unsigned long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+ }
+ h5difftrace("diff_ulong finish\n");
+
+ return nfound;
+}
/*-------------------------------------------------------------------------
@@ -5434,156 +5119,140 @@ static hsize_t diff_llong(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- long long temp1_llong;
- long long temp2_llong;
- hsize_t i;
- double per;
- hbool_t both_zero;
-
- h5difftrace("diff_llong start\n");
- /* -d and !-p */
- if (options->d && !options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_llong, mem1, sizeof(long long));
- HDmemcpy(&temp2_llong, mem2, sizeof(long long));
-
- if (ABS( temp1_llong-temp2_llong) > options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
- }
- nfound++;
- }
- mem1+=sizeof(long long);
- mem2+=sizeof(long long);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
-
- /* !-d and -p */
- else if (!options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_llong, mem1, sizeof(long long));
- HDmemcpy(&temp2_llong, mem2, sizeof(long long));
-
- PER(temp1_llong,temp2_llong);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per);
- }
- nfound++;
- }
- mem1+=sizeof(long long);
- mem2+=sizeof(long long);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_llong, mem1, sizeof(long long));
- HDmemcpy(&temp2_llong, mem2, sizeof(long long));
-
- PER(temp1_llong,temp2_llong);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per);
- }
- nfound++;
- }
- mem1+=sizeof(long long);
- mem2+=sizeof(long long);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
- else
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_llong, mem1, sizeof(long long));
- HDmemcpy(&temp2_llong, mem2, sizeof(long long));
-
- if (temp1_llong != temp2_llong)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
- }
- nfound++;
- }
-
- mem1+=sizeof(long long);
- mem2+=sizeof(long long);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
- h5difftrace("diff_llong finish\n");
+ hsize_t nfound=0; /* number of differences found */
+ long long temp1_llong;
+ long long temp2_llong;
+ hsize_t i;
+ double per;
+ hbool_t both_zero;
- return nfound;
-}
+ h5difftrace("diff_llong start\n");
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_llong, mem1, sizeof(long long));
+ HDmemcpy(&temp2_llong, mem2, sizeof(long long));
+ if (ABS( temp1_llong-temp2_llong) > options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
+ }
+ nfound++;
+ }
+ mem1+=sizeof(long long);
+ mem2+=sizeof(long long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_llong, mem1, sizeof(long long));
+ HDmemcpy(&temp2_llong, mem2, sizeof(long long));
+
+ PER(temp1_llong,temp2_llong);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(long long);
+ mem2+=sizeof(long long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_llong, mem1, sizeof(long long));
+ HDmemcpy(&temp2_llong, mem2, sizeof(long long));
+
+ PER(temp1_llong,temp2_llong);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(long long);
+ mem2+=sizeof(long long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ else
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_llong, mem1, sizeof(long long));
+ HDmemcpy(&temp2_llong, mem2, sizeof(long long));
+
+ if (temp1_llong != temp2_llong)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(long long);
+ mem2+=sizeof(long long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+ }
+ h5difftrace("diff_llong finish\n");
+
+ return nfound;
+}
/*-------------------------------------------------------------------------
@@ -5609,161 +5278,145 @@ static hsize_t diff_ullong(unsigned char *mem1,
int *ph)
{
- hsize_t nfound=0; /* number of differences found */
- unsigned long long temp1_ullong;
- unsigned long long temp2_ullong;
- hsize_t i;
- float f1, f2;
- double per;
- hbool_t both_zero;
-
- h5difftrace("diff_ullong start\n");
- /* -d and !-p */
- if (options->d && !options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
- HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
-
- if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
- }
- nfound++;
- }
- mem1+=sizeof(unsigned long long);
- mem2+=sizeof(unsigned long long);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
-
- /* !-d and -p */
- else if (!options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
- HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
-
- ull2float(temp1_ullong,&f1);
- ull2float(temp2_ullong,&f2);
- PER(f1,f2);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
- }
- nfound++;
- }
- mem1+=sizeof(unsigned long long);
- mem2+=sizeof(unsigned long long);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
-
- }
-
- /* -d and -p */
- else if ( options->d && options->p)
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
- HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
-
- ull2float(temp1_ullong,&f1);
- ull2float(temp2_ullong,&f2);
- PER(f1,f2);
-
- if (not_comparable && !both_zero) /* not comparable */
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
- }
- nfound++;
- }
-
- else
-
- if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta )
- {
- if ( print_data(options) )
- {
- print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
- }
- nfound++;
- }
- mem1+=sizeof(unsigned long long);
- mem2+=sizeof(unsigned long long);
- if (options->n && nfound>=options->count)
- return nfound;
- }
-
- }
- else
- {
-
- for ( i = 0; i < nelmts; i++)
- {
- HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
- HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
-
- if (temp1_ullong != temp2_ullong)
- {
- if ( print_data(options) )
- {
- print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
- }
- nfound++;
- }
-
- mem1+=sizeof(unsigned long long);
- mem2+=sizeof(unsigned long long);
- if (options->n && nfound>=options->count)
- return nfound;
- } /* nelmts */
-
- }
- h5difftrace("diff_ullong finish\n");
+ hsize_t nfound=0; /* number of differences found */
+ unsigned long long temp1_ullong;
+ unsigned long long temp2_ullong;
+ hsize_t i;
+ float f1, f2;
+ double per;
+ hbool_t both_zero;
+
+ h5difftrace("diff_ullong start\n");
+ /* -d and !-p */
+ if (options->d && !options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
+ HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
- return nfound;
-}
+ if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned long long);
+ mem2+=sizeof(unsigned long long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ /* !-d and -p */
+ else if (!options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
+ HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
+ ull2float(temp1_ullong,&f1);
+ ull2float(temp2_ullong,&f2);
+ PER(f1,f2);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned long long);
+ mem2+=sizeof(unsigned long long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ /* -d and -p */
+ else if ( options->d && options->p)
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
+ HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
+
+ ull2float(temp1_ullong,&f1);
+ ull2float(temp2_ullong,&f2);
+ PER(f1,f2);
+
+ if (not_comparable && !both_zero) /* not comparable */
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
+ }
+ nfound++;
+ }
+ else
+ if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta )
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
+ }
+ nfound++;
+ }
+ mem1+=sizeof(unsigned long long);
+ mem2+=sizeof(unsigned long long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ }
+ }
+ else
+ {
+ for ( i = 0; i < nelmts; i++)
+ {
+ HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
+ HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
+
+ if (temp1_ullong != temp2_ullong)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
+ }
+ nfound++;
+ }
+
+ mem1+=sizeof(unsigned long long);
+ mem2+=sizeof(unsigned long long);
+ if (options->n && nfound>=options->count)
+ return nfound;
+ } /* nelmts */
+ }
+ h5difftrace("diff_ullong finish\n");
+
+ return nfound;
+}
/*-------------------------------------------------------------------------
@@ -5781,44 +5434,44 @@ static hsize_t diff_ullong(unsigned char *mem1,
static
int ull2float(unsigned long long ull_value, float *f_value)
{
- hid_t dxpl_id;
- unsigned char *buf = NULL;
- size_t src_size;
- size_t dst_size;
+ hid_t dxpl_id;
+ unsigned char *buf = NULL;
+ size_t src_size;
+ size_t dst_size;
- h5difftrace("ull2float start\n");
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0)
- goto error;
+ h5difftrace("ull2float start\n");
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0)
+ goto error;
- src_size = H5Tget_size(H5T_NATIVE_ULLONG);
- dst_size = H5Tget_size(H5T_NATIVE_FLOAT);
- buf = (unsigned char*)HDcalloc((size_t)1, MAX(src_size, dst_size));
- if(!buf)
- goto error;
+ src_size = H5Tget_size(H5T_NATIVE_ULLONG);
+ dst_size = H5Tget_size(H5T_NATIVE_FLOAT);
+ buf = (unsigned char*)HDcalloc((size_t)1, MAX(src_size, dst_size));
+ if(!buf)
+ goto error;
- HDmemcpy(buf, &ull_value, src_size);
+ HDmemcpy(buf, &ull_value, src_size);
- /* do conversion */
- if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t)1, buf, NULL, dxpl_id)<0)
- goto error;
+ /* do conversion */
+ if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t)1, buf, NULL, dxpl_id)<0)
+ goto error;
- HDmemcpy(f_value, buf, dst_size);
+ HDmemcpy(f_value, buf, dst_size);
- if(buf)
- HDfree(buf);
- h5difftrace("ull2float finish\n");
+ if(buf)
+ HDfree(buf);
+ h5difftrace("ull2float finish\n");
- return 0;
+ return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(dxpl_id);
- } H5E_END_TRY;
- if(buf)
- HDfree(buf);
- h5difftrace("ull2float errored\n");
-
- return -1;
+ H5E_BEGIN_TRY {
+ H5Pclose(dxpl_id);
+ } H5E_END_TRY;
+ if(buf)
+ HDfree(buf);
+ h5difftrace("ull2float errored\n");
+
+ return -1;
}
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 14fbcaa..985a47d 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -186,21 +186,21 @@ void print_type(hid_t type)
*
*-------------------------------------------------------------------------
*/
-const char*
+H5_ATTR_PURE const char*
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);
@@ -217,20 +217,25 @@ diff_basename(const char *name)
*
*-------------------------------------------------------------------------
*/
-const char*
+H5_ATTR_PURE H5_ATTR_CONST const char*
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");
@@ -250,19 +255,23 @@ get_type(h5trav_type_t type)
*
*-------------------------------------------------------------------------
*/
-const char*
+H5_ATTR_PURE const char*
get_sign(H5T_sign_t sign)
{
switch (sign)
{
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";
@@ -281,38 +290,48 @@ get_sign(H5T_sign_t sign)
*
*-------------------------------------------------------------------------
*/
-const char*
+H5_ATTR_PURE const char*
get_class(H5T_class_t tclass)
{
- 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");
+ 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() */
@@ -325,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);
}
@@ -375,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 22c611f..bfcbfb8 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -47,9 +47,9 @@ 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 */
@@ -670,7 +670,7 @@ done:
* Modifications:
*-------------------------------------------------------------------------
*/
-static size_t
+H5_ATTR_PURE static size_t
h5tools_count_ncols(const char *s)
{
register size_t i;
@@ -806,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;
@@ -828,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
@@ -839,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);
@@ -871,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;
@@ -901,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;
@@ -923,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
/*
@@ -937,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);
@@ -960,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;
@@ -1300,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;
}
@@ -1537,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;
@@ -1568,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)
@@ -1641,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;
@@ -1650,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)
@@ -1706,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;
@@ -1764,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");
@@ -1805,7 +1799,7 @@ CATCH
* Return: TRUE if all bytes are zero; FALSE otherwise
*-------------------------------------------------------------------------
*/
-hbool_t
+H5_ATTR_PURE hbool_t
h5tools_is_zero(const void *_mem, size_t size)
{
const unsigned char *mem = (const unsigned char *) _mem;
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index ca2b39a..ed93a46 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -40,7 +40,7 @@
#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 PUTSTREAM(X,S) do { if(S != NULL) HDfputs(X, S); } while(0)
/*
* Strings for output - these were duplicated from the h5dump.h
@@ -294,7 +294,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.
@@ -510,9 +510,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 */
@@ -545,9 +545,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 */
@@ -597,11 +597,11 @@ H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_form
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, 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);
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, int ndims, hid_t type_id, hssize_t npoints);
+ 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 5fb35bf..cae3107 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -207,10 +207,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,
@@ -650,10 +650,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");
@@ -795,20 +795,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;
@@ -823,7 +823,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;
@@ -857,7 +857,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);
@@ -866,13 +866,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;
@@ -938,11 +937,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;
@@ -950,12 +951,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);
@@ -976,12 +979,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);
@@ -1349,7 +1351,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];
@@ -1391,12 +1393,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 {
@@ -1516,6 +1517,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 */
@@ -1545,11 +1547,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)
@@ -1691,10 +1695,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");
@@ -1712,7 +1720,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;
@@ -2599,7 +2607,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 */
@@ -2666,12 +2673,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) {
@@ -2923,6 +2932,8 @@ h5tools_print_virtual_selection(hid_t vspace,
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "%s", VDS_ALL);
break;
+ case H5S_SEL_ERROR:
+ case H5S_SEL_N:
default:
h5tools_str_append(buffer, "Unknown Selection");
}
@@ -3632,7 +3643,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 */
@@ -3771,49 +3782,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_filters.c b/tools/lib/h5tools_filters.c
index ccdba26..748eb78 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -147,58 +147,65 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
*
*-------------------------------------------------------------------------
*/
-int h5tools_can_encode(H5Z_filter_t filtn) {
- switch (filtn) {
+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_str.c b/tools/lib/h5tools_str.c
index 13c6a20..6d9a041 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -91,7 +91,7 @@ h5tools_str_close(h5tools_str_t *str)
*
*-------------------------------------------------------------------------
*/
-size_t
+H5_ATTR_PURE size_t
h5tools_str_len(h5tools_str_t *str)
{
return str->len;
@@ -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;
}
}
@@ -498,41 +495,42 @@ 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(rspace);
+ hssize_t snblocks;
/*
* This function fails if the rspace does not have blocks.
*/
H5E_BEGIN_TRY {
- nblocks = H5Sget_select_hyper_nblocks(rspace);
+ 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(rspace, (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, ")");
}
@@ -557,37 +555,38 @@ void
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(rspace);
+ hssize_t snpoints;
/*
* This function fails if the rspace does not have points.
*/
H5E_BEGIN_TRY {
- npoints = H5Sget_select_elem_npoints(rspace);
+ 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(rspace, (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, ")");
}
@@ -676,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
@@ -690,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, ""));
- }
}
/*-------------------------------------------------------------------------
@@ -753,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);
@@ -823,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;
@@ -843,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
@@ -865,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);
@@ -888,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*/
@@ -899,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));
@@ -964,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));
@@ -977,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))
@@ -995,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))
@@ -1019,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))
@@ -1030,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++;
@@ -1046,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);
@@ -1068,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];
@@ -1090,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)) */
@@ -1149,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;
@@ -1175,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");
@@ -1210,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;
@@ -1459,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);
+ 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_utils.c b/tools/lib/h5tools_utils.c
index b87abf6..0884945 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);
}
@@ -532,7 +532,7 @@ dump_tables(find_objs_t *info)
*
*-------------------------------------------------------------------------
*/
-obj_t *
+H5_ATTR_PURE obj_t *
search_obj(table_t *table, haddr_t objno)
{
unsigned u;
@@ -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) {
@@ -883,12 +883,14 @@ void h5tools_setstatus(int D_status)
h5tools_d_status = D_status;
}
-const char*h5tools_getprogname(void)
+H5_ATTR_PURE const char *
+h5tools_getprogname(void)
{
return h5tools_progname;
}
-int h5tools_getstatus(void)
+H5_ATTR_PURE int
+h5tools_getstatus(void)
{
return h5tools_d_status;
}
@@ -912,7 +914,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 +923,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, ...);
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 86e60c3..66beb0d 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -161,7 +161,7 @@ trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path)
*
*-------------------------------------------------------------------------
*/
-static const char *
+H5_ATTR_PURE static const char *
trav_addr_visited(trav_addr_t *visited, haddr_t addr)
{
size_t u; /* Local index variable */
@@ -490,7 +490,7 @@ h5trav_getinfo(hid_t file_id, trav_info_t *info)
*-------------------------------------------------------------------------
*/
-ssize_t
+H5_ATTR_PURE ssize_t
h5trav_getindex(const trav_info_t *info, const char *obj)
{
size_t u; /* Local index variable */
@@ -681,7 +681,7 @@ h5trav_gettable(hid_t fid, trav_table_t *table)
*-------------------------------------------------------------------------
*/
-int
+H5_ATTR_PURE int
h5trav_getindext(const char *name, const trav_table_t *table)
{
unsigned int i;
@@ -1235,7 +1235,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co
*
*-------------------------------------------------------------------------
*/
-hbool_t
+H5_ATTR_PURE hbool_t
symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
size_t u; /* Local index variable */
diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c
index b85133d..4d79a9b 100644
--- a/tools/lib/io_timer.c
+++ b/tools/lib/io_timer.c
@@ -222,7 +222,7 @@ set_time(io_time_t *pt, timer_type t, int start_stop)
* Programmer: Bill Wendling, 01. October 2001
* Modifications:
*/
-double
+H5_ATTR_PURE double
get_time(io_time_t *pt, timer_type t)
{
return pt->total_time[t];
diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c
index 37d505a..8657cbc 100644
--- a/tools/misc/h5repart.c
+++ b/tools/misc/h5repart.c
@@ -252,9 +252,9 @@ main (int argc, char *argv[])
} /* end while */
/* allocate names */
- if(NULL == (src_name = HDcalloc((size_t)NAMELEN, sizeof(char))))
+ if(NULL == (src_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char))))
exit(EXIT_FAILURE);
- if(NULL == (dst_name = HDcalloc((size_t)NAMELEN, sizeof(char))))
+ if(NULL == (dst_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char))))
exit(EXIT_FAILURE);
/*