diff options
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/h5dump.c | 64 | ||||
-rw-r--r-- | tools/h5dump/h5dump.h | 8 | ||||
-rw-r--r-- | tools/h5dump/h5dump_ddl.c | 150 | ||||
-rw-r--r-- | tools/h5dump/h5dump_extern.h | 6 | ||||
-rw-r--r-- | tools/h5dump/h5dump_xml.c | 1054 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 474 |
6 files changed, 867 insertions, 889 deletions
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; |