diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-08-19 21:16:28 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-08-19 21:16:28 (GMT) |
commit | 525caddd9e0460b2f39d043f04dabc7ab6a1bf3a (patch) | |
tree | 176f2be3724d8160e67de97df457988a27aa2257 /tools | |
parent | d221d97f992d66540d39b0dfdca80b37849a7dd6 (diff) | |
download | hdf5-525caddd9e0460b2f39d043f04dabc7ab6a1bf3a.zip hdf5-525caddd9e0460b2f39d043f04dabc7ab6a1bf3a.tar.gz hdf5-525caddd9e0460b2f39d043f04dabc7ab6a1bf3a.tar.bz2 |
[svn-r19254] Description:
Bring r19252 & 19253 from trunk to 1.8 branch:
Bring Coverity changes from branch to trunk:
r19161:
Fixed the part for matching the subset info with dataset
r19189:
BZ1646: h5dump does not check number of dimensions for subsetting parameters against the dataset
Changed subset_t structure from holding hsize_t pointers to holding new subset_d pointers, which hold the original hsize_t pointer + len. this len is then checked against dataset ndims in the handle_dataset function of h5dump.
Changed all references to use new data structure.
Added tests for each subset parameter.
r19190:
Added new h5dump ddl files
Tested on:
Mac OS X/32 10.6.4 (amazon) w/debug & production
(h5committested on Coverity branch)
Diffstat (limited to 'tools')
29 files changed, 505 insertions, 462 deletions
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c index 20b28e1..89cb5fb 100644 --- a/tools/h5copy/h5copy.c +++ b/tools/h5copy/h5copy.c @@ -176,7 +176,7 @@ static int parse_flag(const char* str_flag, unsigned *flag) } else { - error_msg(h5tools_getprogname(), "Error in input flag\n"); + error_msg("Error in input flag\n"); return -1; } @@ -288,28 +288,28 @@ main (int argc, const char *argv[]) if (fname_src==NULL) { - error_msg(h5tools_getprogname(), "Input file name missing\n"); + error_msg("Input file name missing\n"); usage(); leave(EXIT_FAILURE); } if (fname_dst==NULL) { - error_msg(h5tools_getprogname(), "Output file name missing\n"); + error_msg("Output file name missing\n"); usage(); leave(EXIT_FAILURE); } if (oname_src==NULL) { - error_msg(h5tools_getprogname(), "Source object name missing\n"); + error_msg("Source object name missing\n"); usage(); leave(EXIT_FAILURE); } if (oname_dst==NULL) { - error_msg(h5tools_getprogname(), "Destination object name missing\n"); + error_msg("Destination object name missing\n"); usage(); leave(EXIT_FAILURE); } @@ -326,7 +326,7 @@ main (int argc, const char *argv[]) *-------------------------------------------------------------------------*/ if (fid_src==-1) { - error_msg(h5tools_getprogname(), "Could not open input file <%s>...Exiting\n", fname_src); + error_msg("Could not open input file <%s>...Exiting\n", fname_src); if (fname_src) free(fname_src); leave(EXIT_FAILURE); @@ -349,7 +349,7 @@ main (int argc, const char *argv[]) *-------------------------------------------------------------------------*/ if (fid_dst==-1) { - error_msg(h5tools_getprogname(), "Could not open output file <%s>...Exiting\n", fname_dst); + error_msg("Could not open output file <%s>...Exiting\n", fname_dst); if (fname_src) free(fname_src); if (fname_dst) @@ -390,7 +390,7 @@ main (int argc, const char *argv[]) /* Create link creation property list */ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) { - error_msg(h5tools_getprogname(), "Could not create link creation property list\n"); + error_msg("Could not create link creation property list\n"); goto error; } /* end if */ @@ -398,7 +398,7 @@ main (int argc, const char *argv[]) if(parents) { /* Set the intermediate group creation property */ if(H5Pset_create_intermediate_group(lcpl_id, 1) < 0) { - error_msg(h5tools_getprogname(), "Could not set property for creating parent groups\n"); + error_msg("Could not set property for creating parent groups\n"); goto error; } /* end if */ diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index bdf32d8..773f7bd 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -170,7 +170,7 @@ void parse_command_line(int argc, /* check for file names to be processed */ if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL) { - error_msg(h5tools_getprogname(), "missing file names\n"); + error_msg("missing file names\n"); usage(); h5diff_exit(EXIT_FAILURE); } diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index cf44d13..d990336 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -922,7 +922,7 @@ print_datatype(hid_t type,unsigned in_group) else printf("\"%s\"", obj->objname); } else { - error_msg(h5tools_getprogname(), "unknown committed type.\n"); + error_msg("unknown committed type.\n"); h5tools_setstatus(EXIT_FAILURE); } } else { @@ -1442,7 +1442,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t UNUSED *info, vo if((attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT)) < 0) { indentation(indent + COL); - error_msg(h5tools_getprogname(), "unable to open attribute \"%s\"\n", attr_name); + error_msg("unable to open attribute \"%s\"\n", attr_name); indentation(indent); end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); @@ -1518,7 +1518,7 @@ dump_selected_attr(hid_t loc_id, const char *name) /* Open the object with the attribute */ if((oid = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) { indentation(COL); - error_msg(h5tools_getprogname(), "unable to open object \"%s\"\n", obj_name); + error_msg("unable to open object \"%s\"\n", obj_name); end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); h5tools_setstatus(EXIT_FAILURE); return FAIL; @@ -1545,7 +1545,7 @@ dump_selected_attr(hid_t loc_id, const char *name) dump_header_format->attributeblockend); } else { indentation(COL); - error_msg(h5tools_getprogname(), "unable to open attribute \"%s\"\n", obj_name); + error_msg("unable to open attribute \"%s\"\n", obj_name); end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); h5tools_setstatus(EXIT_FAILURE); } @@ -1600,7 +1600,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED /* Stat the object */ if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) { - error_msg(h5tools_getprogname(), "unable to get object information for \"%s\"\n", name); + error_msg("unable to get object information for \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; goto done; @@ -1611,7 +1611,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED case H5O_TYPE_GROUP: if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) { - error_msg(h5tools_getprogname(), "unable to dump group \"%s\"\n", name); + error_msg("unable to dump group \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } @@ -1650,8 +1650,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED begin_obj(dump_header_format->datasetbegin, name, dump_header_format->datasetblockbegin); indentation(indent + COL); - error_msg(h5tools_getprogname(), - "internal error (file %s:line %d)\n", + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); indentation(indent); end_obj(dump_header_format->datasetend, @@ -1719,7 +1718,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED dump_function_table->dump_dataset_function(obj, name, NULL); H5Dclose(obj); } else { - error_msg(h5tools_getprogname(), "unable to dump dataset \"%s\"\n", name); + error_msg("unable to dump dataset \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } @@ -1727,7 +1726,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED case H5O_TYPE_NAMED_DATATYPE: if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) { - error_msg(h5tools_getprogname(), "unable to dump datatype \"%s\"\n", name); + error_msg("unable to dump datatype \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } else { @@ -1737,7 +1736,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED break; default: - error_msg(h5tools_getprogname(), "unknown object \"%s\"\n", name); + error_msg("unknown object \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } @@ -1758,7 +1757,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED } if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { - error_msg(h5tools_getprogname(), "unable to get link value\n"); + error_msg("unable to get link value\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } else { @@ -1849,7 +1848,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED begin_obj(dump_header_format->extlinkbegin, name, dump_header_format->extlinkblockbegin); if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) { - error_msg(h5tools_getprogname(), "unable to get external link value\n"); + error_msg("unable to get external link value\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } /* end if */ @@ -1858,7 +1857,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED const char *targname; if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) { - error_msg(h5tools_getprogname(), "unable to unpack external link value\n"); + error_msg("unable to unpack external link value\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } /* end if */ @@ -1991,19 +1990,19 @@ dump_named_datatype(hid_t tid, const char *name) if ((tcpl_id = H5Tget_create_plist(tid)) < 0) { - error_msg(h5tools_getprogname(), "error in getting creation property list ID\n"); + error_msg("error in getting creation property list ID\n"); h5tools_setstatus(EXIT_FAILURE); } /* query the creation properties for attributes */ if (H5Pget_attr_creation_order(tcpl_id, &attr_crt_order_flags) < 0) { - error_msg(h5tools_getprogname(), "error in getting creation properties\n"); + error_msg("error in getting creation properties\n"); h5tools_setstatus(EXIT_FAILURE); } if(H5Pclose(tcpl_id) < 0) { - error_msg(h5tools_getprogname(), "error in closing creation property list ID\n"); + error_msg("error in closing creation property list ID\n"); h5tools_setstatus(EXIT_FAILURE); } @@ -2023,7 +2022,7 @@ dump_named_datatype(hid_t tid, const char *name) found_obj = search_obj(type_table, oinfo.addr); if (found_obj == NULL) { - error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n", + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); goto done; @@ -2048,13 +2047,13 @@ dump_named_datatype(hid_t tid, const char *name) if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { if(H5Aiterate2(tid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end if */ else { if(H5Aiterate2(tid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end else */ @@ -2097,26 +2096,26 @@ dump_group(hid_t gid, const char *name) if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { - error_msg(h5tools_getprogname(), "error in getting group creation property list ID\n"); + error_msg("error in getting group creation property list ID\n"); h5tools_setstatus(EXIT_FAILURE); } /* query the group creation properties for attributes */ if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) { - error_msg(h5tools_getprogname(), "error in getting group creation properties\n"); + error_msg("error in getting group creation properties\n"); h5tools_setstatus(EXIT_FAILURE); } /* query the group creation properties */ if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { - error_msg(h5tools_getprogname(), "error in getting group creation properties\n"); + error_msg("error in getting group creation properties\n"); h5tools_setstatus(EXIT_FAILURE); } if(H5Pclose(gcpl_id) < 0) { - error_msg(h5tools_getprogname(), "error in closing group creation property list ID\n"); + error_msg("error in closing group creation property list ID\n"); h5tools_setstatus(EXIT_FAILURE); } @@ -2159,8 +2158,7 @@ dump_group(hid_t gid, const char *name) if (found_obj == NULL) { indentation(indent); - error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n", - __FILE__, __LINE__); + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); } else if (found_obj->displayed) { @@ -2174,13 +2172,13 @@ dump_group(hid_t gid, const char *name) if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end if */ else { if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end else */ @@ -2205,13 +2203,13 @@ dump_group(hid_t gid, const char *name) if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end if */ else { if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end else */ @@ -2258,14 +2256,14 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) if ((dcpl_id = H5Dget_create_plist(did)) < 0) { - error_msg(h5tools_getprogname(), "error in getting creation property list ID\n"); + error_msg("error in getting creation property list ID\n"); h5tools_setstatus(EXIT_FAILURE); } /* query the creation properties for attributes */ if (H5Pget_attr_creation_order(dcpl_id, &attr_crt_order_flags) < 0) { - error_msg(h5tools_getprogname(), "error in getting creation properties\n"); + error_msg("error in getting creation properties\n"); h5tools_setstatus(EXIT_FAILURE); } @@ -2337,13 +2335,13 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { if(H5Aiterate2(did, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end if */ else { if(H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end else */ @@ -2413,14 +2411,14 @@ dump_subsetting_header(struct subset_t *sset, int dims) indentation(indent); printf("%s %s ", dump_header_format->startbegin, dump_header_format->startblockbegin); - dump_dims((hsize_t *)sset->start, dims); + dump_dims(sset->start.data, dims); printf("%s %s\n", dump_header_format->startend, dump_header_format->startblockend); indentation(indent); printf("%s %s ", dump_header_format->stridebegin, dump_header_format->strideblockbegin); - dump_dims(sset->stride, dims); + dump_dims(sset->stride.data, dims); printf("%s %s\n", dump_header_format->strideend, dump_header_format->strideblockend); @@ -2428,8 +2426,8 @@ dump_subsetting_header(struct subset_t *sset, int dims) printf("%s %s ", dump_header_format->countbegin, dump_header_format->countblockbegin); - if (sset->count) - dump_dims(sset->count, dims); + if(sset->count.data) + dump_dims(sset->count.data, dims); else printf("DEFAULT"); @@ -2440,8 +2438,8 @@ dump_subsetting_header(struct subset_t *sset, int dims) printf("%s %s ", dump_header_format->blockbegin, dump_header_format->blockblockbegin); - if (sset->block) - dump_dims(sset->block, dims); + if(sset->block.data) + dump_dims(sset->block.data, dims); else printf("DEFAULT"); @@ -2655,7 +2653,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) if (status == FAIL) { indentation(indent + COL); - error_msg(h5tools_getprogname(), "unable to print data\n"); + error_msg("unable to print data\n"); h5tools_setstatus(EXIT_FAILURE); } @@ -3480,25 +3478,22 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe * semicolons (;). The lists themselves can be separated by * either commas (,) or white spaces. * - * Return: Success: hsize_t array. NULL is a valid return type if - * there aren't any elements in the array. + * Return: <none> * * Programmer: Bill Wendling * Tuesday, 6. February 2001 * - * Modifications: - * *------------------------------------------------------------------------- */ -static hsize_t * -parse_hsize_list(const char *h_list) +static void +parse_hsize_list(const char *h_list, subset_d *d) { hsize_t *p_list; const char *ptr; unsigned int size_count = 0, i = 0, last_digit = 0; if (!h_list || !*h_list || *h_list == ';') - return NULL; + return; /* count how many integers do we have */ for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) @@ -3514,10 +3509,10 @@ parse_hsize_list(const char *h_list) if (size_count == 0) /* there aren't any integers to read */ - return NULL; + return; /* allocate an array for the integers in the list */ - p_list = calloc(size_count, sizeof(hsize_t)); + p_list = (hsize_t *)calloc(size_count, sizeof(hsize_t)); for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) if(isdigit(*ptr)) { @@ -3528,8 +3523,10 @@ parse_hsize_list(const char *h_list) /* scroll to end of integer */ ptr++; } - - return p_list; + d->data = p_list; + d->len = size_count; + + return; } /*------------------------------------------------------------------------- @@ -3561,8 +3558,8 @@ parse_subset_params(char *dset) if (brace > slash) { *brace++ = '\0'; - s = calloc(1, sizeof(struct subset_t)); - s->start = parse_hsize_list(brace); + s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); + parse_hsize_list(brace, &s->start); while (*brace && *brace != ';') brace++; @@ -3570,7 +3567,7 @@ parse_subset_params(char *dset) if (*brace) brace++; - s->stride = parse_hsize_list(brace); + parse_hsize_list(brace, &s->stride); while (*brace && *brace != ';') brace++; @@ -3578,7 +3575,7 @@ parse_subset_params(char *dset) if (*brace) brace++; - s->count = parse_hsize_list(brace); + parse_hsize_list(brace, &s->count); while (*brace && *brace != ';') brace++; @@ -3586,7 +3583,7 @@ parse_subset_params(char *dset) if (*brace) brace++; - s->block = parse_hsize_list(brace); + parse_hsize_list(brace, &s->block); } } @@ -3625,12 +3622,12 @@ parse_mask_list(const char *h_list) while (*ptr) { /* scan for an offset which is an unsigned int */ if (!HDisdigit(*ptr)){ - error_msg(h5tools_getprogname(), "Bad mask list(%s)\n", 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(h5tools_getprogname(), "Packed Bit offset value(%d) must be between 0 and %d\n", + error_msg("Packed Bit offset value(%d) must be between 0 and %d\n", offset_value, PACKED_BITS_SIZE_MAX - 1); return FAIL; } @@ -3640,23 +3637,23 @@ parse_mask_list(const char *h_list) ; /* Look for the common separator */ if (*ptr++ != ',') { - error_msg(h5tools_getprogname(), "Bad mask list(%s), missing expected comma separator.\n", h_list); + error_msg("Bad mask list(%s), missing expected comma separator.\n", h_list); return FAIL; } /* scan for a length which is a positive int */ if (!HDisdigit(*ptr)){ - error_msg(h5tools_getprogname(), "Bad mask list(%s)\n", h_list); + error_msg("Bad mask list(%s)\n", h_list); return FAIL; } length_value = HDatoi(ptr); if (length_value <= 0){ - error_msg(h5tools_getprogname(), "Packed Bit length value(%d) must be positive.\n", + error_msg("Packed Bit length value(%d) must be positive.\n", length_value); return FAIL; }; if ((offset_value + length_value) > PACKED_BITS_SIZE_MAX){ - error_msg(h5tools_getprogname(), "Packed Bit offset+length value(%d) too large. Max is %d\n", + error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", offset_value+length_value, PACKED_BITS_SIZE_MAX); return FAIL; }; @@ -3668,7 +3665,7 @@ parse_mask_list(const char *h_list) /* store the offset,length pair */ if (packed_bits_num >= PACKED_BITS_MAX){ /* too many requests */ - error_msg(h5tools_getprogname(), "Too many masks requested (max. %d). Mask list(%s)\n", + error_msg("Too many masks requested (max. %d). Mask list(%s)\n", PACKED_BITS_MAX, h_list); return FAIL; } @@ -3684,7 +3681,7 @@ parse_mask_list(const char *h_list) if (*ptr == ','){ if (!(*++ptr)){ /* unexpected end of string */ - error_msg(h5tools_getprogname(), "Bad mask list(%s), unexpected end of string.\n", h_list); + error_msg("Bad mask list(%s), unexpected end of string.\n", h_list); return FAIL; } } @@ -3692,7 +3689,7 @@ parse_mask_list(const char *h_list) HDassert(packed_bits_num <= PACKED_BITS_MAX); if (packed_bits_num == 0){ /* got no masks! */ - error_msg(h5tools_getprogname(), "Bad mask list(%s)\n", h_list); + error_msg("Bad mask list(%s)\n", h_list); return FAIL; } return SUCCEED; @@ -3736,7 +3733,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis begin_obj(dump_header_format->datasetbegin, real_name, dump_header_format->datasetblockbegin); indentation(COL); - error_msg(h5tools_getprogname(), "unable to open dataset \"%s\"\n", real_name); + error_msg("unable to open dataset \"%s\"\n", real_name); end_obj(dump_header_format->datasetend, dump_header_format->datasetblockend); h5tools_setstatus(EXIT_FAILURE); @@ -3745,79 +3742,83 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis } /* end if */ if(sset) { - if(!sset->start || !sset->stride || !sset->count || !sset->block) { + unsigned int i; + hid_t sid = H5Dget_space(dsetid); + unsigned int ndims = H5Sget_simple_extent_ndims(sid); + + H5Sclose(sid); + + 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 * dimensions */ - hid_t sid = H5Dget_space(dsetid); - unsigned int ndims = H5Sget_simple_extent_ndims(sid); - - if(!sset->start) + if(!sset->start.data) { /* default to (0, 0, ...) for the start coord */ - sset->start = calloc(ndims, sizeof(hsize_t)); - - if(!sset->stride) { - unsigned int i; - - sset->stride = calloc(ndims, sizeof(hsize_t)); + sset->start.data = (hsize_t *)calloc(ndims, sizeof(hsize_t)); + sset->start.len = ndims; + } + if(!sset->stride.data) { + sset->stride.data = (hsize_t *)calloc(ndims, sizeof(hsize_t)); + sset->stride.len = ndims; for (i = 0; i < ndims; i++) - sset->stride[i] = 1; + sset->stride.data[i] = 1; } - if (!sset->count) { - unsigned int i; - - - sset->count = calloc(ndims, sizeof(hsize_t)); - + if(!sset->count.data) { + sset->count.data = (hsize_t *)calloc(ndims, sizeof(hsize_t)); + sset->count.len = ndims; for (i = 0; i < ndims; i++) - sset->count[i] = 1; + sset->count.data[i] = 1; } - if (!sset->block) { - unsigned int i; - - sset->block = calloc(ndims, sizeof(hsize_t)); - + if(!sset->block.data) { + sset->block.data = (hsize_t *)calloc(ndims, sizeof(hsize_t)); + sset->block.len = ndims; for (i = 0; i < ndims; i++) - sset->block[i] = 1; + sset->block.data[i] = 1; } - - H5Sclose(sid); } - } - - - /*------------------------------------------------------------------------- - * check for block overlap - *------------------------------------------------------------------------- - */ - if(sset) - { - hid_t sid = H5Dget_space(dsetid); - unsigned int ndims = H5Sget_simple_extent_ndims(sid); - unsigned int i; - - for ( i = 0; i < ndims; i++) - { - if ( sset->count[i] > 1 ) - { - - if ( sset->stride[i] < sset->block[i] ) - { - error_msg(h5tools_getprogname(), "wrong subset selection; blocks overlap\n"); + /*------------------------------------------------------------------------- + * check for dimension overflow + *------------------------------------------------------------------------- + */ + if(sset->start.len > ndims) { + error_msg("number of start dims (%u) exceed dataset dims (%u)\n", sset->start.len, ndims); + h5tools_setstatus(EXIT_FAILURE); + return; + } + if(sset->stride.len > ndims) { + error_msg("number of stride dims (%u) exceed dataset dims (%u)\n", sset->stride.len, ndims); + h5tools_setstatus(EXIT_FAILURE); + return; + } + if(sset->count.len > ndims) { + error_msg("number of count dims (%u) exceed dataset dims (%u)\n", sset->count.len, ndims); + h5tools_setstatus(EXIT_FAILURE); + return; + } + if(sset->block.len > ndims) { + error_msg("number of block dims (%u) exceed dataset dims (%u)\n", sset->block.len, ndims); + h5tools_setstatus(EXIT_FAILURE); + return; + } + + /*------------------------------------------------------------------------- + * check for block overlap + *------------------------------------------------------------------------- + */ + for(i = 0; i < ndims; i++) { + if(sset->count.data[i] > 1) { + if(sset->stride.data[i] < sset->block.data[i]) { + error_msg("wrong subset selection; blocks overlap\n"); h5tools_setstatus(EXIT_FAILURE); return; + } /* end if */ + } /* end if */ + } /* end for */ + } /* end if */ - } - - } - - } - H5Sclose(sid); - - } H5Oget_info(dsetid, &oinfo); if(oinfo.rc > 1 || hit_elink) { @@ -3883,7 +3884,7 @@ handle_groups(hid_t fid, const char *group, void UNUSED * data, int pe, const ch { begin_obj(dump_header_format->groupbegin, real_name, dump_header_format->groupblockbegin); indentation(COL); - error_msg(h5tools_getprogname(), "unable to open group \"%s\"\n", real_name); + error_msg("unable to open group \"%s\"\n", real_name); end_obj(dump_header_format->groupend, dump_header_format->groupblockend); h5tools_setstatus(EXIT_FAILURE); } @@ -3895,7 +3896,7 @@ handle_groups(hid_t fid, const char *group, void UNUSED * data, int pe, const ch if(prefix_len <= new_len) { prefix_len = new_len; - prefix = HDrealloc(prefix, prefix_len); + prefix = (char *)HDrealloc(prefix, prefix_len); } /* end if */ HDstrcpy(prefix, group); @@ -3927,13 +3928,13 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co H5L_info_t linfo; if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) { - error_msg(h5tools_getprogname(), "unable to get link info from \"%s\"\n", links); + error_msg("unable to get link info from \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); } else if(linfo.type == H5L_TYPE_HARD) { - error_msg(h5tools_getprogname(), "\"%s\" is a hard link\n", links); + error_msg("\"%s\" is a hard link\n", links); h5tools_setstatus(EXIT_FAILURE); } else { - char *buf = HDmalloc(linfo.u.val_size); + char *buf = (char *)HDmalloc(linfo.u.val_size); switch(linfo.type) { case H5L_TYPE_SOFT: /* Soft link */ @@ -3943,7 +3944,7 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) printf("LINKTARGET \"%s\"\n", buf); else { - error_msg(h5tools_getprogname(), "h5dump error: unable to get link value for \"%s\"\n", + error_msg("h5dump error: unable to get link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); } @@ -3969,11 +3970,11 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co indentation(COL); printf("TARGETPATH \"%s\"\n", elink_path); } else { - error_msg(h5tools_getprogname(), "h5dump error: unable to unpack external link value for \"%s\"\n", links); + error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); } } else { - error_msg(h5tools_getprogname(), "h5dump error: unable to get external link value for \"%s\"\n", links); + error_msg("h5dump error: unable to get external link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); } end_obj(dump_header_format->extlinkend, @@ -4050,7 +4051,7 @@ handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe, const begin_obj(dump_header_format->datatypebegin, real_name, dump_header_format->datatypeblockbegin); indentation(COL); - error_msg(h5tools_getprogname(), "unable to open datatype \"%s\"\n", real_name); + error_msg("unable to open datatype \"%s\"\n", real_name); end_obj(dump_header_format->datatypeend, dump_header_format->datatypeblockend); h5tools_setstatus(EXIT_FAILURE); @@ -4107,7 +4108,7 @@ parse_command_line(int argc, const char *argv[]) } /* this will be plenty big enough to hold the info */ - hand = calloc((size_t)argc, sizeof(struct handler_t)); + hand = (struct handler_t *)calloc((size_t)argc, sizeof(struct handler_t)); /* parse command line options */ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { @@ -4179,7 +4180,7 @@ parse_start: hand[i].func = handle_datasets; hand[i].obj = HDstrdup(opt_arg); hand[i].subset_info = parse_subset_params(hand[i].obj); - last_dset = hand; + last_dset = &hand[i]; break; } @@ -4283,8 +4284,7 @@ parse_start: #ifdef H5_HAVE_H5DUMP_PACKED_BITS case 'M': if (!last_was_dset) { - error_msg(h5tools_getprogname(), - "option `-%c' can only be used after --dataset option\n", + error_msg("option `-%c' can only be used after --dataset option\n", opt); leave(EXIT_FAILURE); } @@ -4348,8 +4348,7 @@ parse_start: struct subset_t *s; if (!last_was_dset) { - error_msg(h5tools_getprogname(), - "option `-%c' can only be used after --dataset option\n", + error_msg("option `-%c' can only be used after --dataset option\n", opt); leave(EXIT_FAILURE); } @@ -4361,7 +4360,7 @@ parse_start: */ s = last_dset->subset_info; } else { - last_dset->subset_info = s = calloc(1, sizeof(struct subset_t)); + last_dset->subset_info = s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); } /* @@ -4377,10 +4376,10 @@ parse_start: */ do { switch ((char)opt) { - case 's': free(s->start); s->start = parse_hsize_list(opt_arg); break; - case 'S': free(s->stride); s->stride = parse_hsize_list(opt_arg); break; - case 'c': free(s->count); s->count = parse_hsize_list(opt_arg); break; - case 'k': free(s->block); s->block = parse_hsize_list(opt_arg); break; + case 's': free(s->start.data); parse_hsize_list(opt_arg, &s->start); break; + case 'S': free(s->stride.data); parse_hsize_list(opt_arg, &s->stride); break; + case 'c': free(s->count.data); parse_hsize_list(opt_arg, &s->count); break; + case 'k': free(s->block.data); parse_hsize_list(opt_arg, &s->block); break; default: goto end_collect; } } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF); @@ -4408,7 +4407,7 @@ end_collect: parse_end: /* check for file name to be processed */ if (argc <= opt_ind) { - error_msg(h5tools_getprogname(), "missing file name\n"); + error_msg("missing file name\n"); usage(h5tools_getprogname()); leave(EXIT_FAILURE); } @@ -4441,10 +4440,10 @@ free_handler(struct handler_t *hand, int len) free(hand[i].obj); if (hand[i].subset_info) { - free(hand[i].subset_info->start); - free(hand[i].subset_info->stride); - free(hand[i].subset_info->count); - free(hand[i].subset_info->block); + free(hand[i].subset_info->start.data); + free(hand[i].subset_info->stride.data); + free(hand[i].subset_info->count.data); + free(hand[i].subset_info->block.data); free(hand[i].subset_info); } } @@ -4518,42 +4517,42 @@ main(int argc, const char *argv[]) if ( bin_output && outfname == NULL ) { - error_msg(h5tools_getprogname(), "binary output requires a file name, use -o <filename>\n"); + error_msg("binary output requires a file name, use -o <filename>\n"); leave(EXIT_FAILURE); } /* Check for conflicting options */ if (doxml) { if (!display_all) { - error_msg(h5tools_getprogname(), "option \"%s\" not available for XML\n", + error_msg("option \"%s\" not available for XML\n", "to display selected objects"); leave(EXIT_FAILURE); } else if (display_bb) { - error_msg(h5tools_getprogname(), "option \"%s\" not available for XML\n", + error_msg("option \"%s\" not available for XML\n", "--boot-block"); leave(EXIT_FAILURE); } else if (display_oid == 1) { - error_msg(h5tools_getprogname(), "option \"%s\" not available for XML\n", + error_msg("option \"%s\" not available for XML\n", "--object-ids"); leave(EXIT_FAILURE); } else if (display_char == TRUE) { - error_msg(h5tools_getprogname(), "option \"%s\" not available for XML\n", + error_msg("option \"%s\" not available for XML\n", "--string"); leave(EXIT_FAILURE); } else if (usingdasho) { - error_msg(h5tools_getprogname(), "option \"%s\" not available for XML\n", + error_msg("option \"%s\" not available for XML\n", "--output"); leave(EXIT_FAILURE); } } else { if (xml_dtd_uri) { - warn_msg(h5tools_getprogname(), "option \"%s\" only applies with XML: %s\n", + warn_msg("option \"%s\" only applies with XML: %s\n", "--xml-dtd", xml_dtd_uri); } } if (argc <= opt_ind) { - error_msg(h5tools_getprogname(), "missing file name\n"); + error_msg("missing file name\n"); usage(h5tools_getprogname()); leave(EXIT_FAILURE); } @@ -4562,7 +4561,7 @@ main(int argc, const char *argv[]) fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0); if (fid < 0) { - error_msg(h5tools_getprogname(), "unable to open file \"%s\"\n", fname); + error_msg("unable to open file \"%s\"\n", fname); leave(EXIT_FAILURE); } @@ -4588,7 +4587,7 @@ main(int argc, const char *argv[]) } } else { if (useschema && strcmp(xmlnsprefix,"")) { - error_msg(h5tools_getprogname(), "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); + error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); leave(EXIT_FAILURE); } } @@ -4597,14 +4596,14 @@ main(int argc, const char *argv[]) /* Get object info for root group */ if(H5Oget_info_by_name(fid, "/", &oi, H5P_DEFAULT) < 0) { - error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n", __FILE__, __LINE__); + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); goto done; } /* Initialize object tables */ if(table_list_add(fid, oi.fileno) < 0) { - error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n", __FILE__, __LINE__); + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); goto done; } @@ -4667,7 +4666,7 @@ main(int argc, const char *argv[]) { if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) { - error_msg(h5tools_getprogname(), "unable to open root group\n"); + error_msg("unable to open root group\n"); h5tools_setstatus(EXIT_FAILURE); } else @@ -4679,7 +4678,7 @@ main(int argc, const char *argv[]) if(H5Gclose(gid) < 0) { - error_msg(h5tools_getprogname(), "unable to close root group\n"); + error_msg("unable to close root group\n"); h5tools_setstatus(EXIT_FAILURE); } @@ -4689,7 +4688,7 @@ main(int argc, const char *argv[]) { /* Note: this option is not supported for XML */ if(doxml) { - error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n", __FILE__, __LINE__); + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); goto done; } /* end if */ @@ -4773,8 +4772,8 @@ print_enum(hid_t type) dst_size = H5Tget_size(type); /* Get the names and raw values of all members */ - name = calloc(nmembs, sizeof(char *)); - value = calloc(nmembs, MAX(H5Tget_size(type), dst_size)); + name = (char **)calloc(nmembs, sizeof(char *)); + value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size)); for (i = 0; i < nmembs; i++) { name[i] = H5Tget_member_name(type, i); @@ -4934,7 +4933,7 @@ xml_escape_the_name(const char *str) return HDstrdup(str); cp = str; - rcp = ncp = HDmalloc(len + extra + 1); + rcp = ncp = (char *)HDmalloc(len + extra + 1); if (!ncp) return NULL; /* ?? */ @@ -5023,7 +5022,7 @@ xml_escape_the_string(const char *str, int slen) } cp = str; - rcp = ncp = calloc((len + extra + 1), sizeof(char)); + rcp = ncp = (char *)calloc((len + extra + 1), sizeof(char)); if (ncp == NULL) return NULL; /* ?? */ @@ -5115,7 +5114,7 @@ xml_print_datatype(hid_t type, unsigned in_group) /* This should be defined somewhere else */ /* These 2 cases are handled the same right now, but probably will have something different eventually */ - char * dtxid = malloc(100); + char * dtxid = (char *)malloc(100); xml_name_to_XID(found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { @@ -5475,7 +5474,7 @@ xml_dump_datatype(hid_t type) if(found_obj) { /* Shared datatype, must be entered as an object */ /* These 2 cases are the same now, but may change */ - char * dtxid = malloc(100); + char * dtxid = (char *)malloc(100); xml_name_to_XID(found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { @@ -5854,14 +5853,14 @@ xml_dump_named_datatype(hid_t type, const char *name) char *t_prefix; char *t_name; - tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); HDstrcpy(tmp, prefix); HDstrcat(tmp, "/"); HDstrcat(tmp, name); indentation(indent); - dtxid = HDmalloc(100); - parentxid = HDmalloc(100); + dtxid = (char *)HDmalloc(100); + parentxid = (char *)HDmalloc(100); t_tmp = xml_escape_the_name(tmp); t_prefix = xml_escape_the_name(prefix); t_name = xml_escape_the_name(name); @@ -5901,7 +5900,7 @@ xml_dump_named_datatype(hid_t type, const char *name) if (found_obj == NULL) { indentation(indent); - error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n", + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); goto done; @@ -5982,26 +5981,26 @@ xml_dump_group(hid_t gid, const char *name) if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { - error_msg(h5tools_getprogname(), "error in getting group creation property list ID\n"); + error_msg("error in getting group creation property list ID\n"); h5tools_setstatus(EXIT_FAILURE); } /* query the group creation properties for attributes */ if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) { - error_msg(h5tools_getprogname(), "error in getting group creation properties\n"); + error_msg("error in getting group creation properties\n"); h5tools_setstatus(EXIT_FAILURE); } /* query the group creation properties */ if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { - error_msg(h5tools_getprogname(), "error in getting group creation properties\n"); + error_msg("error in getting group creation properties\n"); h5tools_setstatus(EXIT_FAILURE); } if(H5Pclose(gcpl_id) < 0) { - error_msg(h5tools_getprogname(), "error in closing group creation property list ID\n"); + error_msg("error in closing group creation property list ID\n"); h5tools_setstatus(EXIT_FAILURE); } @@ -6009,7 +6008,7 @@ xml_dump_group(hid_t gid, const char *name) isRoot = 1; tmp = HDstrdup("/"); } else { - tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); HDstrcpy(tmp, prefix); par = HDstrdup(tmp); cp = HDstrrchr(par, '/'); @@ -6034,16 +6033,16 @@ xml_dump_group(hid_t gid, const char *name) if (found_obj == NULL) { indentation(indent); - error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n", + error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); } else { char *t_name = xml_escape_the_name(name); - char *grpxid = malloc(100); - char *parentxid = malloc(100); + char *grpxid = (char *)malloc(100); + char *parentxid = (char *)malloc(100); if(found_obj->displayed) { - char *ptrstr = malloc(100); + char *ptrstr = (char *)malloc(100); /* already seen: enter a groupptr */ if(isRoot) { @@ -6101,13 +6100,13 @@ xml_dump_group(hid_t gid, const char *name) if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end if */ else { if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end else */ @@ -6145,8 +6144,8 @@ xml_dump_group(hid_t gid, const char *name) /* only link -- must be first time! */ char *t_name = xml_escape_the_name(name); - char *grpxid = malloc(100); - char *parentxid = malloc(100); + char *grpxid = (char *)malloc(100); + char *parentxid = (char *)malloc(100); if(isRoot) { xml_name_to_XID("/", grpxid, 100, 1); @@ -6173,13 +6172,13 @@ xml_dump_group(hid_t gid, const char *name) if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end if */ else { if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end else */ @@ -6263,7 +6262,7 @@ xml_print_refs(hid_t did, int source) ssiz = H5Sget_simple_extent_npoints(space); ssiz *= H5Tget_size(type); - buf = calloc((size_t)ssiz, sizeof(char)); + buf = (char *)calloc((size_t)ssiz, sizeof(char)); if(buf == NULL) return FAIL; e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); @@ -6277,7 +6276,7 @@ xml_print_refs(hid_t did, int source) ssiz = H5Sget_simple_extent_npoints(space); ssiz *= H5Tget_size(type); - buf = calloc((size_t)ssiz, sizeof(char)); + buf = (char *)calloc((size_t)ssiz, sizeof(char)); if (buf == NULL) { free(buf); return FAIL; @@ -6398,7 +6397,7 @@ xml_print_strs(hid_t did, int source) tsiz = H5Tget_size(type); bp = (char*)buf; if(!is_vlstr) - onestring = (char *) calloc(tsiz, sizeof(char)); + onestring = (char *)calloc(tsiz, sizeof(char)); for (i = 0; i < ssiz; i++) { if(is_vlstr) { @@ -6671,10 +6670,10 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) char *tmp; char *t_name, *t_tmp, *t_prefix; unsigned attr_crt_order_flags; - char *rstr = HDmalloc(100); - char *pstr = HDmalloc(100); + char *rstr = (char *)HDmalloc(100); + char *pstr = (char *)HDmalloc(100); - tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); HDstrcpy(tmp, prefix); HDstrcat(tmp, "/"); HDstrcat(tmp, name); @@ -6706,7 +6705,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) /* Print information about storage layout */ if(H5D_CHUNKED == H5Pget_layout(dcpl)) { maxdims = H5Sget_simple_extent_ndims(space); - chsize = (hsize_t *) malloc(maxdims * sizeof(hsize_t)); + chsize = (hsize_t *)malloc(maxdims * sizeof(hsize_t)); indent += COL; indentation(indent); printf("<%sStorageLayout>\n",xmlnsprefix); @@ -6839,13 +6838,13 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) { if(H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end if */ else { if(H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) { - error_msg(h5tools_getprogname(), "error getting attribute information\n"); + error_msg("error getting attribute information\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ } /* end else */ @@ -6989,8 +6988,8 @@ xml_print_enum(hid_t type) } /* Get the names and raw values of all members */ - name = calloc(nmembs, sizeof(char *)); - value = calloc(nmembs, MAX(H5Tget_size(type), dst_size)); + name = (char **)calloc(nmembs, sizeof(char *)); + value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size)); for (i = 0; i < nmembs; i++) { name[i] = H5Tget_member_name(type, i); @@ -7174,7 +7173,7 @@ static void init_prefix(char **prfx, size_t prfx_len) { HDassert(prfx_len > 0); - *prfx = HDcalloc(prfx_len, 1); + *prfx = (char *)HDcalloc(prfx_len, 1); } @@ -7195,7 +7194,7 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name) /* Check if we need more space */ if(*prfx_len <= new_len) { *prfx_len = new_len + 1; - *prfx = HDrealloc(*prfx, *prfx_len); + *prfx = (char *)HDrealloc(*prfx, *prfx_len); } /* Append object name to prefix */ diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index d8fcf26..2f271b1 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -427,6 +427,12 @@ TOOLTEST tindicessub3.ddl -d 3d -s 0,1,2 -S 1,3,3 -c 2,2,2 -k 1,2,2 taindices. # 4D case TOOLTEST tindicessub4.ddl -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5 +#Exceed the dimensions for subsetting +TOOLTEST1 texceedsubstart.ddl -d 1d -s 1,3 taindices.h5 +TOOLTEST1 texceedsubcount.ddl -d 1d -c 1,3 taindices.h5 +TOOLTEST1 texceedsubstride.ddl -d 1d -S 1,3 taindices.h5 +TOOLTEST1 texceedsubblock.ddl -d 1d -k 1,3 taindices.h5 + # tests for filters # SZIP @@ -534,6 +540,11 @@ TOOLTEST tattrregR.ddl -R tattrreg.h5 TOOLTEST2 tbinregR.exp -d /Dataset1 -s 0 -y -o $TESTDIR/tbinregR.txt tdatareg.h5 +# Clean up text output files +if test -z "$HDF5_NOCLEANUP"; then + rm -f $TESTDIR/tbinregR.txt +fi + # tests for group creation order # "1" tracked, "2" name, root tracked TOOLTEST tordergr1.ddl --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5 diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c index 7468db2..293aa17 100644 --- a/tools/h5jam/getub.c +++ b/tools/h5jam/getub.c @@ -97,7 +97,7 @@ parse_command_line (int argc, const char *argv[]) if (argc <= opt_ind) { - error_msg (h5tools_getprogname(), "missing file name\n"); + error_msg("missing file name\n"); usage (h5tools_getprogname()); exit (EXIT_FAILURE); } @@ -120,13 +120,13 @@ main (int argc, const char *argv[]) if (nbytes == NULL) { /* missing arg */ - error_msg (h5tools_getprogname(), "missing size\n"); + error_msg("missing size\n"); usage (h5tools_getprogname()); exit (EXIT_FAILURE); } if (argc <= (opt_ind)) { - error_msg (h5tools_getprogname(), "missing file name\n"); + error_msg("missing file name\n"); usage (h5tools_getprogname()); exit (EXIT_FAILURE); } @@ -137,7 +137,7 @@ main (int argc, const char *argv[]) if (res == EOF) { /* fail */ - error_msg (h5tools_getprogname(), "missing file name\n"); + error_msg("missing file name\n"); usage (h5tools_getprogname()); exit (EXIT_FAILURE); } @@ -145,7 +145,7 @@ main (int argc, const char *argv[]) fd = HDopen (filename, O_RDONLY, 0); if (fd < 0) { - error_msg (h5tools_getprogname(), "can't open file %s\n", filename); + error_msg("can't open file %s\n", filename); exit (EXIT_FAILURE); } diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index 6fdd744..17b1384 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -193,7 +193,7 @@ main (int argc, const char *argv[]) if (ub_file == NULL) { /* no user block */ - error_msg (h5tools_getprogname(), "no user block file name\n"); + error_msg("no user block file name\n"); usage (h5tools_getprogname()); exit (EXIT_FAILURE); } @@ -201,7 +201,7 @@ main (int argc, const char *argv[]) if (input_file == NULL) { /* no user block */ - error_msg (h5tools_getprogname(), "no HDF5 file\n"); + error_msg("no HDF5 file\n"); usage (h5tools_getprogname()); exit (EXIT_FAILURE); } @@ -210,7 +210,7 @@ main (int argc, const char *argv[]) if (testval <= 0) { - error_msg (h5tools_getprogname(), "Input HDF5 file is not HDF \"%s\"\n", input_file); + error_msg("Input HDF5 file is not HDF \"%s\"\n", input_file); exit (EXIT_FAILURE); } @@ -218,14 +218,14 @@ main (int argc, const char *argv[]) if (ifile < 0) { - error_msg (h5tools_getprogname(), "Can't open input HDF5 file \"%s\"\n", input_file); + error_msg("Can't open input HDF5 file \"%s\"\n", input_file); exit (EXIT_FAILURE); } plist = H5Fget_create_plist (ifile); if (plist < 0) { - error_msg (h5tools_getprogname(), "Can't get file creation plist for file \"%s\"\n", + error_msg("Can't get file creation plist for file \"%s\"\n", input_file); exit (EXIT_FAILURE); } @@ -233,7 +233,7 @@ main (int argc, const char *argv[]) status = H5Pget_userblock (plist, &usize); if (status < 0) { - error_msg (h5tools_getprogname(), "Can't get user block for file \"%s\"\n", + error_msg("Can't get user block for file \"%s\"\n", input_file); exit (EXIT_FAILURE); } @@ -245,7 +245,7 @@ main (int argc, const char *argv[]) if (ufid < 0) { - error_msg (h5tools_getprogname(), "unable to open user block file \"%s\"\n", + error_msg("unable to open user block file \"%s\"\n", ub_file); exit (EXIT_FAILURE); } @@ -254,7 +254,7 @@ main (int argc, const char *argv[]) if (res < 0) { - error_msg (h5tools_getprogname(), "Can't stat file \"%s\"\n", ub_file); + error_msg("Can't stat file \"%s\"\n", ub_file); exit (EXIT_FAILURE); } @@ -264,7 +264,7 @@ main (int argc, const char *argv[]) if (h5fid < 0) { - error_msg (h5tools_getprogname(), "unable to open HDF5 file for read \"%s\"\n", + error_msg("unable to open HDF5 file for read \"%s\"\n", input_file); exit (EXIT_FAILURE); } @@ -273,7 +273,7 @@ main (int argc, const char *argv[]) if (res < 0) { - error_msg (h5tools_getprogname(), "Can't stat file \"%s\"\n", input_file); + error_msg("Can't stat file \"%s\"\n", input_file); exit (EXIT_FAILURE); } @@ -285,7 +285,7 @@ main (int argc, const char *argv[]) if (ofid < 0) { - error_msg (h5tools_getprogname(), "unable to open output file \"%s\"\n", + error_msg("unable to open output file \"%s\"\n", output_file); exit (EXIT_FAILURE); } @@ -296,7 +296,7 @@ main (int argc, const char *argv[]) if (ofid < 0) { - error_msg (h5tools_getprogname(), "unable to create output file \"%s\"\n", + error_msg("unable to create output file \"%s\"\n", output_file); exit (EXIT_FAILURE); } @@ -399,7 +399,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, if (startin > startout) { /* this case is prohibited */ - error_msg (h5tools_getprogname(), "copy_some_to_file: panic: startin > startout?\n"); + error_msg("copy_some_to_file: panic: startin > startout?\n"); exit (EXIT_FAILURE); } @@ -409,7 +409,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, if (res < 0) { - error_msg (h5tools_getprogname(), "Can't stat file \n"); + error_msg("Can't stat file \n"); exit (EXIT_FAILURE); } diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index a69fd45..8e31ce1 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -141,7 +141,7 @@ parse_command_line(int argc, const char *argv[]) /* check for file name to be processed */ /* if (argc <= opt_ind+2) { - error_msg(h5tools_getprogname(), "missing file name\n"); + error_msg("missing file name\n"); usage(h5tools_getprogname()); exit(EXIT_FAILURE); } @@ -191,32 +191,32 @@ main(int argc, const char *argv[]) testval = H5Fis_hdf5(input_file); if (testval <= 0) { - error_msg(h5tools_getprogname(), "Input HDF5 file is not HDF \"%s\"\n", input_file); + error_msg("Input HDF5 file is not HDF \"%s\"\n", input_file); exit(EXIT_FAILURE); } ifile = H5Fopen(input_file, H5F_ACC_RDONLY , H5P_DEFAULT); if (ifile < 0) { - error_msg(h5tools_getprogname(), "Can't open input HDF5 file \"%s\"\n", input_file); + error_msg("Can't open input HDF5 file \"%s\"\n", input_file); exit(EXIT_FAILURE); } plist = H5Fget_create_plist(ifile); if (plist < 0) { - error_msg(h5tools_getprogname(), "Can't get file creation plist for file \"%s\"\n", input_file); + error_msg("Can't get file creation plist for file \"%s\"\n", input_file); exit(EXIT_FAILURE); } status = H5Pget_userblock(plist, & usize ); if (status < 0) { - error_msg(h5tools_getprogname(), "Can't get user block for file \"%s\"\n", input_file); + error_msg("Can't get user block for file \"%s\"\n", input_file); exit(EXIT_FAILURE); } if (usize == 0) { /* no user block to remove: message? */ - error_msg(h5tools_getprogname(), "\"%s\" has no user block: no change to file\n", input_file); + error_msg("\"%s\" has no user block: no change to file\n", input_file); exit(EXIT_SUCCESS); } @@ -224,7 +224,7 @@ main(int argc, const char *argv[]) res = stat(input_file, &sbuf); if (res < 0) { - error_msg(h5tools_getprogname(), "Can't stat file \"%s\"\n", input_file); + error_msg("Can't stat file \"%s\"\n", input_file); exit(EXIT_FAILURE); } @@ -233,12 +233,12 @@ main(int argc, const char *argv[]) ifid = HDopen(input_file,O_RDONLY,0); if (ifid < 0) { - error_msg(h5tools_getprogname(), "unable to open input HDF5 file \"%s\"\n", input_file); + error_msg("unable to open input HDF5 file \"%s\"\n", input_file); exit(EXIT_FAILURE); } if (do_delete && (ub_file != NULL)) { - error_msg(h5tools_getprogname(), "??\"%s\"\n", ub_file); + error_msg("??\"%s\"\n", ub_file); exit(EXIT_FAILURE); } @@ -249,7 +249,7 @@ main(int argc, const char *argv[]) ufid = HDopen(ub_file,O_WRONLY|O_CREAT|O_TRUNC, 0644 ); if (ufid < 0) { - error_msg(h5tools_getprogname(), "unable to open user block file for output\"%s\"\n", ub_file); + error_msg("unable to open user block file for output\"%s\"\n", ub_file); exit(EXIT_FAILURE); } } @@ -258,14 +258,14 @@ main(int argc, const char *argv[]) h5fid = HDopen(input_file,O_WRONLY, 0); if (h5fid < 0) { - error_msg(h5tools_getprogname(), "unable to open output HDF5 file \"%s\"\n", input_file); + error_msg("unable to open output HDF5 file \"%s\"\n", input_file); exit(EXIT_FAILURE); } } else { h5fid = HDopen(output_file,O_WRONLY|O_CREAT|O_TRUNC, 0644 ); if (h5fid < 0) { - error_msg(h5tools_getprogname(), "unable to open output HDF5 file \"%s\"\n", output_file); + error_msg("unable to open output HDF5 file \"%s\"\n", output_file); exit(EXIT_FAILURE); } } @@ -274,7 +274,7 @@ main(int argc, const char *argv[]) /* copy from 0 to 'usize - 1' into ufid */ if (!do_delete) { if(copy_to_file(ifid, ufid, 0, (ssize_t) usize) < 0) { - error_msg(h5tools_getprogname(), "unable to copy user block to output file \"%s\"\n", ub_file); + error_msg("unable to copy user block to output file \"%s\"\n", ub_file); exit(EXIT_FAILURE); } } @@ -283,7 +283,7 @@ main(int argc, const char *argv[]) * starting at end of user block if present */ if(copy_to_file(ifid, h5fid, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) { - error_msg(h5tools_getprogname(), "unable to copy hdf5 data to output file \"%s\"\n", output_file); + error_msg("unable to copy hdf5 data to output file \"%s\"\n", output_file); exit(EXIT_FAILURE); } diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c index 450759f..f1b6756 100644 --- a/tools/h5jam/tellub.c +++ b/tools/h5jam/tellub.c @@ -104,7 +104,7 @@ parse_command_line (int argc, const char *argv[]) /* check for file name to be processed */ if (argc <= opt_ind) { - error_msg (h5tools_getprogname(), "missing file name\n"); + error_msg("missing file name\n"); usage (h5tools_getprogname()); exit (EXIT_FAILURE); } @@ -147,7 +147,7 @@ main (int argc, const char *argv[]) if (argc <= (opt_ind)) { - error_msg (h5tools_getprogname(), "missing file name\n"); + error_msg("missing file name\n"); usage (h5tools_getprogname()); return (EXIT_FAILURE); } @@ -158,7 +158,7 @@ main (int argc, const char *argv[]) if (testval <= 0) { - error_msg (h5tools_getprogname(), "Input HDF5 file is not HDF \"%s\"\n", ifname); + error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname); return (EXIT_FAILURE); } @@ -166,14 +166,14 @@ main (int argc, const char *argv[]) if (ifile < 0) { - error_msg (h5tools_getprogname(), "Can't open input HDF5 file \"%s\"\n", ifname); + error_msg("Can't open input HDF5 file \"%s\"\n", ifname); return (EXIT_FAILURE); } plist = H5Fget_create_plist (ifile); if (plist < 0) { - error_msg (h5tools_getprogname(), "Can't get file creation plist for file \"%s\"\n", + error_msg("Can't get file creation plist for file \"%s\"\n", ifname); return (EXIT_FAILURE); } @@ -181,7 +181,7 @@ main (int argc, const char *argv[]) status = H5Pget_userblock (plist, &usize); if (status < 0) { - error_msg (h5tools_getprogname(), "Can't get user block for file \"%s\"\n", ifname); + error_msg("Can't get user block for file \"%s\"\n", ifname); return (EXIT_FAILURE); } diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index e1b2182..4a1f4d7 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -153,7 +153,7 @@ int h5repack_addfilter(const char* str, if(options->n_filter_g > H5_REPACK_MAX_NFILTERS) { - error_msg(h5tools_getprogname(), "maximum number of filters exceeded for <%s>\n", str); + error_msg("maximum number of filters exceeded for <%s>\n", str); free(obj_list); return -1; } @@ -191,7 +191,7 @@ int h5repack_addlayout(const char* str, init_packobject(&pack); if (options->all_layout==1){ - error_msg(h5tools_getprogname(), "invalid layout input: 'all' option \ + error_msg("invalid layout input: 'all' option \ is present with other objects <%s>\n",str); return -1; } @@ -507,7 +507,7 @@ int copy_attr(hid_t loc_in, buf = (void *)HDmalloc((size_t)(nelmts * msize)); if(buf == NULL) { - error_msg(h5tools_getprogname(), "cannot read into memory\n" ); + error_msg("h5repack", "cannot read into memory\n" ); goto error; } if(H5Aread(attr_id, wtype_id, buf) < 0) @@ -610,7 +610,7 @@ static int check_options(pack_opt_t *options) break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: - error_msg(h5tools_getprogname(), "invalid layout\n"); + error_msg("invalid layout\n"); return -1; default: strcpy(slayout,"invalid layout\n"); @@ -651,7 +651,7 @@ static int check_options(pack_opt_t *options) if (options->all_layout==1 && has_ck) { - error_msg(h5tools_getprogname(), "invalid chunking input: 'all' option\ + error_msg("invalid chunking input: 'all' option\ is present with other objects\n"); return -1; } @@ -713,7 +713,7 @@ static int check_options(pack_opt_t *options) if (options->all_filter==1 && has_cp) { - error_msg(h5tools_getprogname(), "invalid compression input: 'all' option\ + error_msg("invalid compression input: 'all' option\ is present with other objects\n"); return -1; } @@ -725,24 +725,24 @@ static int check_options(pack_opt_t *options) if (options->grp_compact < 0) { - error_msg(h5tools_getprogname(), "invalid maximum number of links to store as header messages\n"); + error_msg("invalid maximum number of links to store as header messages\n"); return -1; } if (options->grp_indexed < 0) { - error_msg(h5tools_getprogname(), "invalid minimum number of links to store in the indexed format\n"); + error_msg("invalid minimum number of links to store in the indexed format\n"); return -1; } if (options->grp_indexed > options->grp_compact) { - error_msg(h5tools_getprogname(), "minimum indexed size is greater than the maximum compact size\n"); + error_msg("minimum indexed size is greater than the maximum compact size\n"); return -1; } for (i=0; i<8; i++) { if (options->msg_size[i]<0) { - error_msg(h5tools_getprogname(), "invalid shared message size\n"); + error_msg("invalid shared message size\n"); return -1; } } @@ -764,7 +764,7 @@ static int check_options(pack_opt_t *options) if ( options->ublock_filename == NULL && options->ublock_size != 0 ) { - error_msg(h5tools_getprogname(), "file name missing for user block\n", + error_msg("file name missing for user block\n", options->ublock_filename); return -1; } @@ -777,7 +777,7 @@ static int check_options(pack_opt_t *options) if ( options->alignment == 0 && options->threshold != 0 ) { - error_msg(h5tools_getprogname(), "alignment for H5Pset_alignment missing\n"); + error_msg("alignment for H5Pset_alignment missing\n"); return -1; } @@ -849,7 +849,7 @@ static int check_objects(const char* fname, /* the input object names are present in the file and are valid */ if(h5trav_getindext(name, travt) < 0) { - error_msg(h5tools_getprogname(), "%s Could not find <%s> in file <%s>. Exiting...\n", + error_msg("%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose?"\n":""),name,fname); goto out; } @@ -971,7 +971,7 @@ static const char* get_sfilter(H5Z_filter_t filtn) else if (filtn==H5Z_FILTER_SCALEOFFSET) return "SOFF"; else { - error_msg(h5tools_getprogname(), "input error in filter type\n"); + error_msg("input error in filter type\n"); exit(EXIT_FAILURE); } } diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index ece870f..6853297 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -89,7 +89,7 @@ int copy_objects(const char* fnamein, */ if((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { - error_msg(h5tools_getprogname(), "<%s>: %s\n", fnamein, H5FOPENERROR ); + error_msg("<%s>: %s\n", fnamein, H5FOPENERROR ); goto out; } @@ -99,19 +99,19 @@ int copy_objects(const char* fnamein, if((fcpl_in = H5Fget_create_plist(fidin)) < 0) { - error_msg(h5tools_getprogname(), "failed to retrieve file creation property list\n"); + error_msg("failed to retrieve file creation property list\n"); goto out; } if(H5Pget_userblock(fcpl_in, &ub_size) < 0) { - error_msg(h5tools_getprogname(), "failed to retrieve userblock size\n"); + error_msg("failed to retrieve userblock size\n"); goto out; } if(H5Pclose(fcpl_in) < 0) { - error_msg(h5tools_getprogname(), "failed to close property list\n"); + error_msg("failed to close property list\n"); goto out; } } @@ -122,7 +122,7 @@ int copy_objects(const char* fnamein, /* Create file creation property list */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { - error_msg(h5tools_getprogname(), "fail to create a file creation property list\n"); + error_msg("fail to create a file creation property list\n"); goto out; } @@ -130,7 +130,7 @@ int copy_objects(const char* fnamein, { if(H5Pset_userblock(fcpl, ub_size) < 0) { - error_msg(h5tools_getprogname(), "failed to set non-default userblock size\n"); + error_msg("failed to set non-default userblock size\n"); goto out; } } @@ -143,7 +143,7 @@ int copy_objects(const char* fnamein, /* (So that it is created in "dense storage" form) */ if(H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0) { - error_msg(h5tools_getprogname(), "fail to adjust group creation parameters for root group\n"); + error_msg("fail to adjust group creation parameters for root group\n"); goto out; } @@ -185,7 +185,7 @@ int copy_objects(const char* fnamein, { if(H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) { - error_msg(h5tools_getprogname(), "fail to set the number of shared object header message indexes\n"); + error_msg("fail to set the number of shared object header message indexes\n"); goto out; } @@ -193,7 +193,7 @@ int copy_objects(const char* fnamein, for(i = 0; i < (nindex - 1); i++) { if(H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) { - error_msg(h5tools_getprogname(), "fail to configure the specified shared object header message index\n"); + error_msg("fail to configure the specified shared object header message index\n"); goto out; } /* end if */ } /* end for */ @@ -202,13 +202,13 @@ int copy_objects(const char* fnamein, /* Create file access property list */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg(h5tools_getprogname(), "Could not create file access property list\n"); + error_msg("Could not create file access property list\n"); goto out; } /* end if */ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { - error_msg(h5tools_getprogname(), "Could not set property for using latest version of the format\n"); + error_msg("Could not set property for using latest version of the format\n"); goto out; } /* end if */ } /* end if */ @@ -235,7 +235,7 @@ int copy_objects(const char* fnamein, /* set user block size */ if(H5Pset_userblock(fcpl, options->ublock_size) < 0) { - error_msg(h5tools_getprogname(), "failed to set userblock size\n"); + error_msg("failed to set userblock size\n"); goto out; } @@ -247,14 +247,14 @@ int copy_objects(const char* fnamein, /* create a file creation property list */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { - error_msg(h5tools_getprogname(), "fail to create a file creation property list\n"); + error_msg("fail to create a file creation property list\n"); goto out; } /* set user block size */ if(H5Pset_userblock(fcpl, options->ublock_size) < 0) { - error_msg(h5tools_getprogname(), "failed to set userblock size\n"); + error_msg("failed to set userblock size\n"); goto out; } @@ -279,7 +279,7 @@ int copy_objects(const char* fnamein, if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { - error_msg(h5tools_getprogname(), "failed to set alignment\n"); + error_msg("failed to set alignment\n"); goto out; } @@ -291,13 +291,13 @@ int copy_objects(const char* fnamein, /* create a file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg(h5tools_getprogname(), "Could not create file access property list\n"); + error_msg("Could not create file access property list\n"); goto out; } if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { - error_msg(h5tools_getprogname(), "failed to set alignment\n"); + error_msg("failed to set alignment\n"); goto out; } @@ -318,7 +318,7 @@ int copy_objects(const char* fnamein, if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0) { - error_msg(h5tools_getprogname(), "<%s>: Could not create file\n", fnameout ); + error_msg("<%s>: Could not create file\n", fnameout ); goto out; } @@ -331,7 +331,7 @@ int copy_objects(const char* fnamein, { if ( copy_user_block( options->ublock_filename, fnameout, options->ublock_size) < 0 ) { - error_msg(h5tools_getprogname(), "Could not copy user block. Exiting...\n"); + error_msg("Could not copy user block. Exiting...\n"); goto out; } @@ -355,7 +355,7 @@ int copy_objects(const char* fnamein, */ if(do_copy_objects(fidin, fidout, travt, options) < 0) { - error_msg(h5tools_getprogname(), "<%s>: Could not copy data to: %s\n", fnamein, fnameout); + error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout); goto out; } /* end if */ @@ -397,7 +397,7 @@ int copy_objects(const char* fnamein, { if ( copy_user_block(fnamein, fnameout, ub_size) < 0 ) { - error_msg(h5tools_getprogname(), "Could not copy user block. Exiting...\n"); + error_msg("Could not copy user block. Exiting...\n"); goto out; } @@ -1357,19 +1357,19 @@ void print_user_block(const char *filename, hid_t fid) /* get user block size */ if(( fcpl = H5Fget_create_plist(fid)) < 0) { - error_msg(h5tools_getprogname(), "failed to retrieve file creation property list\n"); + error_msg("failed to retrieve file creation property list\n"); goto done; } if(H5Pget_userblock(fcpl, &ub_size) < 0) { - error_msg(h5tools_getprogname(), "failed to retrieve userblock size\n"); + error_msg("failed to retrieve userblock size\n"); goto done; } if(H5Pclose(fcpl) < 0) { - error_msg(h5tools_getprogname(), "failed to close property list\n"); + error_msg("failed to close property list\n"); goto done; } diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index aaabeac..3cc65d0 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -124,7 +124,7 @@ int main(int argc, const char **argv) if ( strcmp( infile, outfile ) == 0 ) { - error_msg(h5tools_getprogname(), "file names cannot be the same\n"); + error_msg("file names cannot be the same\n"); usage(h5tools_getprogname()); exit(EXIT_FAILURE); @@ -133,7 +133,7 @@ int main(int argc, const char **argv) else { - error_msg(h5tools_getprogname(), "file names missing\n"); + error_msg("file names missing\n"); usage(h5tools_getprogname()); exit(EXIT_FAILURE); } @@ -320,7 +320,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) /* parse the -f filter option */ if (h5repack_addfilter( opt_arg, options)<0) { - error_msg(h5tools_getprogname(), "in parsing filter\n"); + error_msg("in parsing filter\n"); exit(EXIT_FAILURE); } break; @@ -329,7 +329,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) /* parse the -l layout option */ if (h5repack_addlayout( opt_arg, options)<0) { - error_msg(h5tools_getprogname(), "in parsing layout\n"); + error_msg("in parsing layout\n"); exit(EXIT_FAILURE); } break; @@ -340,7 +340,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) options->min_comp = atoi( opt_arg ); if ((int)options->min_comp<=0) { - error_msg(h5tools_getprogname(), "invalid minimum compress size <%s>\n", opt_arg ); + error_msg("invalid minimum compress size <%s>\n", opt_arg ); exit(EXIT_FAILURE); } break; @@ -433,7 +433,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) options->alignment = atol( opt_arg ); if ( options->alignment < 1 ) { - error_msg(h5tools_getprogname(), "invalid alignment size\n", opt_arg ); + error_msg("invalid alignment size\n", opt_arg ); exit(EXIT_FAILURE); } break; @@ -448,7 +448,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options) /* check for file names to be processed */ if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL) { - error_msg(h5tools_getprogname(), "missing file names\n"); + error_msg("missing file names\n"); usage(h5tools_getprogname()); exit(EXIT_FAILURE); } @@ -492,7 +492,7 @@ void read_info(const char *filename, if ((fp = fopen(data_file, "r")) == (FILE *)NULL) { - error_msg(h5tools_getprogname(), "cannot open options file %s\n", filename); + error_msg("cannot open options file %s\n", filename); exit(EXIT_FAILURE); } @@ -529,7 +529,7 @@ void read_info(const char *filename, comp_info[i-1]='\0'; /*cut the last " */ if (h5repack_addfilter(comp_info,options)==-1){ - error_msg(h5tools_getprogname(), "could not add compression option\n"); + error_msg("could not add compression option\n"); exit(EXIT_FAILURE); } } @@ -559,7 +559,7 @@ void read_info(const char *filename, comp_info[i-1]='\0'; /*cut the last " */ if (h5repack_addlayout(comp_info,options)==-1){ - error_msg(h5tools_getprogname(), "could not add chunck option\n"); + error_msg("could not add chunck option\n"); exit(EXIT_FAILURE); } } @@ -568,7 +568,7 @@ void read_info(const char *filename, *------------------------------------------------------------------------- */ else { - error_msg(h5tools_getprogname(), "bad file format for %s", filename); + error_msg("bad file format for %s", filename); exit(EXIT_FAILURE); } } diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index d1cb97a..50f97bd 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -65,7 +65,7 @@ static void aux_tblinsert_filter(pack_opttbl_t *table, } else { - error_msg(h5tools_getprogname(), "cannot insert the filter in this object.\ + error_msg("cannot insert the filter in this object.\ Maximum capacity exceeded\n"); } } @@ -124,7 +124,7 @@ static int aux_inctable(pack_opttbl_t *table, int n_objs ) table->size += n_objs; table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs==NULL) { - error_msg(h5tools_getprogname(), "not enough memory for options table\n"); + error_msg("not enough memory for options table\n"); return -1; } for (i = table->nelems; i < table->size; i++) @@ -151,7 +151,7 @@ int options_table_init( pack_opttbl_t **tbl ) if(NULL == (table = (pack_opttbl_t *)malloc(sizeof(pack_opttbl_t)))) { - error_msg(h5tools_getprogname(), "not enough memory for options table\n"); + error_msg("not enough memory for options table\n"); return -1; } @@ -159,7 +159,7 @@ int options_table_init( pack_opttbl_t **tbl ) table->nelems = 0; if(NULL == (table->objs = (pack_info_t*)malloc(table->size * sizeof(pack_info_t)))) { - error_msg(h5tools_getprogname(), "not enough memory for options table\n"); + error_msg("not enough memory for options table\n"); free(table); return -1; } @@ -230,7 +230,7 @@ int options_add_layout( obj_list_t *obj_list, /* already chunk info inserted for this one; exit */ if (table->objs[i].chunk.rank>0) { - error_msg(h5tools_getprogname(), "chunk information already inserted for <%s>\n",obj_list[j].obj); + error_msg("chunk information already inserted for <%s>\n",obj_list[j].obj); exit(EXIT_FAILURE); } /* insert the layout info */ diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index b5753e6..d3a7419 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -96,7 +96,7 @@ obj_list_t* parse_filter(const char *str, obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t)); if (obj_list==NULL) { - error_msg(h5tools_getprogname(), "could not allocate object list\n"); + error_msg("could not allocate object list\n"); return NULL; } *n_objs=n; @@ -119,7 +119,7 @@ obj_list_t* parse_filter(const char *str, if (end_obj+1==(int)len) { if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "input Error: Invalid compression type in <%s>\n",str); + error_msg("input Error: Invalid compression type in <%s>\n",str); exit(EXIT_FAILURE); } @@ -157,7 +157,7 @@ obj_list_t* parse_filter(const char *str, c = str[u]; if (!isdigit(c) && l==-1){ if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "compression parameter not digit in <%s>\n",str); + error_msg("compression parameter not digit in <%s>\n",str); exit(EXIT_FAILURE); } if (l==-1) @@ -177,7 +177,7 @@ obj_list_t* parse_filter(const char *str, filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK; else { - error_msg(h5tools_getprogname(), "szip mask must be 'NN' or 'EC' \n"); + error_msg("szip mask must be 'NN' or 'EC' \n"); exit(EXIT_FAILURE); } @@ -217,7 +217,7 @@ obj_list_t* parse_filter(const char *str, c = str[u]; if (!isdigit(c) && l==-1){ if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "compression parameter is not a digit in <%s>\n",str); + error_msg("compression parameter is not a digit in <%s>\n",str); exit(EXIT_FAILURE); } if (l==-1) @@ -237,7 +237,7 @@ obj_list_t* parse_filter(const char *str, filt->cd_values[j++]=H5Z_SO_FLOAT_DSCALE; else { - error_msg(h5tools_getprogname(), "scale type must be 'IN' or 'DS' \n"); + error_msg("scale type must be 'IN' or 'DS' \n"); exit(EXIT_FAILURE); } @@ -261,7 +261,7 @@ obj_list_t* parse_filter(const char *str, c = str[u]; if (!isdigit(c)){ if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "compression parameter is not a digit in <%s>\n",str); + error_msg("compression parameter is not a digit in <%s>\n",str); exit(EXIT_FAILURE); } stype[m]=c; @@ -307,7 +307,7 @@ obj_list_t* parse_filter(const char *str, if (no_param) { /*no more parameters, GZIP must have parameter */ if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "missing compression parameter in <%s>\n",str); + error_msg("missing compression parameter in <%s>\n",str); exit(EXIT_FAILURE); } } @@ -323,7 +323,7 @@ obj_list_t* parse_filter(const char *str, if (no_param) { /*no more parameters, SZIP must have parameter */ if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "missing compression parameter in <%s>\n",str); + error_msg("missing compression parameter in <%s>\n",str); exit(EXIT_FAILURE); } } @@ -339,7 +339,7 @@ obj_list_t* parse_filter(const char *str, if (m>0) { /*shuffle does not have parameter */ if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "extra parameter in SHUF <%s>\n",str); + error_msg("extra parameter in SHUF <%s>\n",str); exit(EXIT_FAILURE); } } @@ -354,7 +354,7 @@ obj_list_t* parse_filter(const char *str, if (m>0) { /*shuffle does not have parameter */ if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "extra parameter in FLET <%s>\n",str); + error_msg("extra parameter in FLET <%s>\n",str); exit(EXIT_FAILURE); } } @@ -369,7 +369,7 @@ obj_list_t* parse_filter(const char *str, if (m>0) { /*nbit does not have parameter */ if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "extra parameter in NBIT <%s>\n",str); + error_msg("extra parameter in NBIT <%s>\n",str); exit(EXIT_FAILURE); } } @@ -384,13 +384,13 @@ obj_list_t* parse_filter(const char *str, if (no_param) { /*no more parameters, SOFF must have parameter */ if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "missing compression parameter in <%s>\n",str); + error_msg("missing compression parameter in <%s>\n",str); exit(EXIT_FAILURE); } } else { if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "invalid filter type in <%s>\n",str); + error_msg("invalid filter type in <%s>\n",str); exit(EXIT_FAILURE); } } @@ -413,7 +413,7 @@ obj_list_t* parse_filter(const char *str, if (filt->cd_values[0]>9 ) { if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "invalid compression parameter in <%s>\n",str); + error_msg("invalid compression parameter in <%s>\n",str); exit(EXIT_FAILURE); } break; @@ -428,19 +428,19 @@ obj_list_t* parse_filter(const char *str, if ((pixels_per_block%2)==1) { if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "pixels_per_block is not even in <%s>\n",str); + error_msg("pixels_per_block is not even in <%s>\n",str); exit(EXIT_FAILURE); } if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK) { if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "pixels_per_block is too large in <%s>\n",str); + error_msg("pixels_per_block is too large in <%s>\n",str); exit(EXIT_FAILURE); } if ( (strcmp(smask,"NN")!=0) && (strcmp(smask,"EC")!=0) ) { if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "szip mask must be 'NN' or 'EC' \n"); + error_msg("szip mask must be 'NN' or 'EC' \n"); exit(EXIT_FAILURE); } break; @@ -517,7 +517,7 @@ obj_list_t* parse_layout(const char *str, obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t)); if (obj_list==NULL) { - error_msg(h5tools_getprogname(), "could not allocate object list\n"); + error_msg("could not allocate object list\n"); return NULL; } *n_objs=n; @@ -541,7 +541,7 @@ obj_list_t* parse_layout(const char *str, if (end_obj+1==(int)len) { if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "in parse layout, no characters after : in <%s>\n",str); + error_msg("in parse layout, no characters after : in <%s>\n",str); exit(EXIT_FAILURE); } @@ -558,7 +558,7 @@ obj_list_t* parse_layout(const char *str, else if (strcmp(slayout,"CHUNK")==0) pack->layout=H5D_CHUNKED; else { - error_msg(h5tools_getprogname(), "in parse layout, not a valid layout in <%s>\n",str); + error_msg("in parse layout, not a valid layout in <%s>\n",str); exit(EXIT_FAILURE); } } @@ -582,7 +582,7 @@ obj_list_t* parse_layout(const char *str, if (j>(int)len) { if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "in parse layout, <%s> Chunk dimensions missing\n",str); + error_msg("in parse layout, <%s> Chunk dimensions missing\n",str); exit(EXIT_FAILURE); } @@ -596,7 +596,7 @@ obj_list_t* parse_layout(const char *str, && c!='N' && c!='O' && c!='N' && c!='E' ){ if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "in parse layout, <%s> Not a valid character in <%s>\n", + error_msg("in parse layout, <%s> Not a valid character in <%s>\n", sdim,str); exit(EXIT_FAILURE); } @@ -609,7 +609,7 @@ obj_list_t* parse_layout(const char *str, pack->chunk.chunk_lengths[c_index]=atoi(sdim); if (pack->chunk.chunk_lengths[c_index]==0) { if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "in parse layout, <%s> conversion to number in <%s>\n", + error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim,str); exit(EXIT_FAILURE); } @@ -627,7 +627,7 @@ obj_list_t* parse_layout(const char *str, pack->chunk.chunk_lengths[c_index]=atoi(sdim); if (pack->chunk.chunk_lengths[c_index]==0){ if (obj_list) free(obj_list); - error_msg(h5tools_getprogname(), "in parse layout, <%s> conversion to number in <%s>\n", + error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim,str); exit(EXIT_FAILURE); } diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 90a3671..d83f23b 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -312,12 +312,12 @@ int h5repack_cmp_pl(const char *fname1, /* Open the files */ if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) { - error_msg(h5tools_getprogname(), "<%s>: %s\n", fname1, H5FOPENERROR ); + error_msg("<%s>: %s\n", fname1, H5FOPENERROR ); return -1; } if ((fid2=H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) { - error_msg(h5tools_getprogname(), "<%s>: %s\n", fname2, H5FOPENERROR ); + error_msg("<%s>: %s\n", fname2, H5FOPENERROR ); H5Fclose(fid1); return -1; } @@ -366,7 +366,7 @@ int h5repack_cmp_pl(const char *fname1, if ( crt_order_flag1 != crt_order_flag2 ) { - error_msg(h5tools_getprogname(), "property lists for <%s> are different\n",trav->objs[i].name); + error_msg("property lists for <%s> are different\n",trav->objs[i].name); goto error; } @@ -394,7 +394,7 @@ int h5repack_cmp_pl(const char *fname1, if(ret == 0) { - error_msg(h5tools_getprogname(), "property lists for <%s> are different\n",trav->objs[i].name); + error_msg("property lists for <%s> are different\n",trav->objs[i].name); goto error; } diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 0176fd5..57b1ce0 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -790,7 +790,7 @@ parse_command_line(int argc, const char *argv[]) /* check for file name to be processed */ if (argc <= opt_ind) { - error_msg(h5tools_getprogname(), "missing file name\n"); + error_msg("missing file name\n"); usage(h5tools_getprogname()); leave(EXIT_FAILURE); } /* end if */ @@ -1340,7 +1340,7 @@ main(int argc, const char *argv[]) h5tools_init(); hand = parse_command_line (argc, argv); if(!hand) { - error_msg(h5tools_getprogname(), "unable to parse command line arguments \n"); + error_msg("unable to parse command line arguments \n"); leave(EXIT_FAILURE); } /* end if */ @@ -1350,7 +1350,7 @@ main(int argc, const char *argv[]) fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT); if(fid < 0) { - error_msg(h5tools_getprogname(), "unable to open file \"%s\"\n", fname); + error_msg("unable to open file \"%s\"\n", fname); leave(EXIT_FAILURE); } /* end if */ @@ -1359,7 +1359,7 @@ main(int argc, const char *argv[]) /* Get storge info for SOHM's btree/list/heap and superblock extension */ if(H5Fget_info(fid, &finfo) < 0) - warn_msg(h5tools_getprogname(), "Unable to retrieve SOHM info\n"); + warn_msg("Unable to retrieve SOHM info\n"); else { iter.super_ext_size = finfo.super_ext_size; iter.SM_hdr_storage_size = finfo.sohm.hdr_size; @@ -1368,10 +1368,10 @@ main(int argc, const char *argv[]) } /* end else */ if((fcpl = H5Fget_create_plist(fid)) < 0) - warn_msg(h5tools_getprogname(), "Unable to retrieve file creation property\n"); + warn_msg("Unable to retrieve file creation property\n"); if(H5Pget_userblock(fcpl, &iter.ublk_size) < 0) - warn_msg(h5tools_getprogname(), "Unable to retrieve userblock size\n"); + warn_msg("Unable to retrieve userblock size\n"); /* Walk the objects or all file */ if(display_object) { @@ -1380,7 +1380,7 @@ main(int argc, const char *argv[]) u = 0; while(hand[u].obj) { if (h5trav_visit(fid, hand[u].obj, TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0) - warn_msg(h5tools_getprogname(), "Unable to traverse object \"%s\"\n", hand[u].obj); + warn_msg("Unable to traverse object \"%s\"\n", hand[u].obj); else print_statistics(hand[u].obj, &iter); u++; @@ -1388,7 +1388,7 @@ main(int argc, const char *argv[]) } /* end if */ else { if (h5trav_visit(fid, "/", TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0) - warn_msg(h5tools_getprogname(), "Unable to traverse objects/links in file \"%s\"\n", fname); + warn_msg("Unable to traverse objects/links in file \"%s\"\n", fname); else print_statistics("/", &iter); } /* end else */ @@ -1396,7 +1396,7 @@ main(int argc, const char *argv[]) if (hand) free(hand); if(H5Fclose(fid) < 0) { - error_msg(h5tools_getprogname(), "unable to close file \"%s\"\n", fname); + error_msg("unable to close file \"%s\"\n", fname); leave(EXIT_FAILURE); } diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index ede6ea0..71993b8 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -154,7 +154,6 @@ hsize_t diff_attr(hid_t loc1_id, */ void print_found(hsize_t nfound); -void parallel_print(const char* format, ... ); void print_type(hid_t type); const char* diff_basename(const char *name); const char* get_type(h5trav_type_t type); diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 30c01f9..bc127a2 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -22,76 +22,6 @@ /* global variables */ int g_nTasks = 1; -unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */ -char outBuff[OUTBUFF_SIZE]; -int outBuffOffset; -FILE* overflow_file = NULL; - -/*------------------------------------------------------------------------- - * Function: parallel_print - * - * Purpose: wrapper for printf for use in parallel mode. - * - * Programmer: Leon Arber - * - * Date: December 1, 2004 - * - *------------------------------------------------------------------------- - */ -void parallel_print(const char* format, ...) -{ - int bytes_written; - va_list ap; - - va_start(ap, format); - - if(!g_Parallel) - vprintf(format, ap); - else - { - - if(overflow_file == NULL) /*no overflow has occurred yet */ - { -#if 0 - printf("calling HDvsnprintf: OUTBUFF_SIZE=%ld, outBuffOffset=%ld, ", (long)OUTBUFF_SIZE, (long)outBuffOffset); -#endif - bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap); -#if 0 - printf("bytes_written=%ld\n", (long)bytes_written); -#endif - va_end(ap); - va_start(ap, format); - -#if 0 - printf("Result: bytes_written=%ld, OUTBUFF_SIZE-outBuffOffset=%ld\n", (long)bytes_written, (long)OUTBUFF_SIZE-outBuffOffset); -#endif - - if ((bytes_written < 0) || -#ifdef H5_VSNPRINTF_WORKS - (bytes_written >= (OUTBUFF_SIZE-outBuffOffset)) -#else - ((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset)) -#endif - ) - { - /* Terminate the outbuff at the end of the previous output */ - outBuff[outBuffOffset] = '\0'; - - overflow_file = HDtmpfile(); - if(overflow_file == NULL) - fprintf(stderr, "warning: could not create overflow file. Output may be truncated.\n"); - else - bytes_written = HDvfprintf(overflow_file, format, ap); - } - else - outBuffOffset += bytes_written; - } - else - bytes_written = HDvfprintf(overflow_file, format, ap); - - } - va_end(ap); -} /*------------------------------------------------------------------------- * Function: print_dimensions diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index e0ead62..d7aab94 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1990,7 +1990,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c if (ctx->ndims > 0) init_acc_pos(ctx, total_size); - size_row_block = sset->block[row_dim]; + size_row_block = sset->block.data[row_dim]; /* display loop */ for (; hyperslab_count > 0; temp_start[row_dim] += temp_stride[row_dim], hyperslab_count--) { @@ -1998,9 +1998,9 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c cases where block > 1 only and stride > block */ if (size_row_block > 1 && row_counter == size_row_block - && sset->stride[row_dim] > sset->block[row_dim]) { + && sset->stride.data[row_dim] > sset->block.data[row_dim]) { - hsize_t increase_rows = sset->stride[row_dim] - sset->block[row_dim]; + hsize_t increase_rows = sset->stride.data[row_dim] - sset->block.data[row_dim]; temp_start[row_dim] += increase_rows; row_counter = 0; } @@ -2158,22 +2158,22 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools if (ctx->ndims > 2) for (i = 0; i < (size_t) ctx->ndims - 2; i++) { /* consider block size */ - outer_count = outer_count * sset->count[i] * sset->block[i]; + outer_count = outer_count * sset->count.data[i] * sset->block.data[i]; } /* initialize temporary start, count and maximum start */ for (i = 0; i < (size_t) ctx->ndims; i++) { - temp_start[i] = sset->start[i]; - temp_count[i] = sset->count[i]; - temp_block[i] = sset->block[i]; - temp_stride[i] = sset->stride[i]; + temp_start[i] = sset->start.data[i]; + temp_count[i] = sset->count.data[i]; + temp_block[i] = sset->block.data[i]; + temp_stride[i] = sset->stride.data[i]; max_start[i] = 0; } if (ctx->ndims > 2) { for (i = 0; i < (size_t) ctx->ndims - 2; i++) { - max_start[i] = temp_start[i] + sset->count[i]; + max_start[i] = temp_start[i] + sset->count.data[i]; temp_count[i] = 1; } @@ -2186,14 +2186,14 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools /* count is the number of iterations to display all the rows, the block size count times */ - count = sset->count[row_dim] * sset->block[row_dim]; + count = sset->count.data[row_dim] * sset->block.data[row_dim]; /* always 1 row_counter at a time, that is a block of size 1, 1 time */ temp_count[row_dim] = 1; temp_block[row_dim] = 1; /* advance 1 row_counter at a time */ - if (sset->block[row_dim] > 1) + if (sset->block.data[row_dim] > 1) temp_stride[row_dim] = 1; } @@ -2212,7 +2212,7 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools /* set start to original from current_outer_dim up */ for (i = current_outer_dim + 1; i < ctx->ndims; i++) { - temp_start[i] = sset->start[i]; + temp_start[i] = sset->start.data[i]; } /* increment start dimension */ @@ -2220,10 +2220,10 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools reset_dim = 0; temp_start[current_outer_dim]++; if (temp_start[current_outer_dim] >= max_start[current_outer_dim]) { - temp_start[current_outer_dim] = sset->start[current_outer_dim]; + temp_start[current_outer_dim] = sset->start.data[current_outer_dim]; /* consider block */ - if (sset->block[current_outer_dim] > 1) + if (sset->block.data[current_outer_dim] > 1) temp_start[current_outer_dim]++; current_outer_dim--; @@ -2631,7 +2631,6 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, H5S_class_t space_type; int status = FAIL; h5tool_format_t info_dflt; - /* Use default values */ if (!stream) stream = stdout; @@ -2666,12 +2665,10 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, /* Print the data */ if (space_type == H5S_SIMPLE || space_type == H5S_SCALAR) { - if (!sset) { + if(!sset) status = h5tools_dump_simple_dset(stream, info, dset, p_type, indentlevel); - } - else { + else status = h5tools_dump_simple_subset(stream, info, dset, p_type, sset, indentlevel); - } } else /* space is H5S_NULL */ diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 219e85d..0c919ae 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -507,12 +507,17 @@ typedef struct h5tools_context_t { hsize_t sm_pos; /* current stripmine element position */ } h5tools_context_t; +typedef struct subset_d { + hsize_t *data; + unsigned int len; +} subset_d; + /* a structure to hold the subsetting particulars for a dataset */ struct subset_t { - hsize_t *start; - hsize_t *stride; - hsize_t *count; - hsize_t *block; + subset_d start; + subset_d stride; + subset_d count; + subset_d block; }; /* The following include, h5tools_str.h, must be after the diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index e18d6d3..07d2a57 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -119,7 +119,7 @@ init_ref_path_table(void) /* Iterate over objects in this file */ if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL) < 0) { - error_msg(h5tools_getprogname(), "unable to construct reference path table\n"); + error_msg("unable to construct reference path table\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 8fa2c43..2e3c756 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -42,6 +42,12 @@ const char *opt_arg; /*flag argument (or value) */ static int h5tools_d_status = 0; static const char *h5tools_progname = "h5tools"; +/* ``parallel_print'' variables */ +unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */ +char outBuff[OUTBUFF_SIZE]; +int outBuffOffset; +FILE* overflow_file = NULL; + /* local functions */ static void init_table(table_t **tbl); #ifdef H5DUMP_DEBUG @@ -49,6 +55,72 @@ static void dump_table(char* tablename, table_t *table); #endif /* H5DUMP_DEBUG */ static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t recorded); +/*------------------------------------------------------------------------- + * Function: parallel_print + * + * Purpose: wrapper for printf for use in parallel mode. + * + * Programmer: Leon Arber + * + * Date: December 1, 2004 + * + *------------------------------------------------------------------------- + */ +void parallel_print(const char* format, ...) +{ + int bytes_written; + va_list ap; + + va_start(ap, format); + + if(!g_Parallel) + vprintf(format, ap); + else + { + + if(overflow_file == NULL) /*no overflow has occurred yet */ + { +#if 0 + printf("calling HDvsnprintf: OUTBUFF_SIZE=%ld, outBuffOffset=%ld, ", (long)OUTBUFF_SIZE, (long)outBuffOffset); +#endif + bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap); +#if 0 + printf("bytes_written=%ld\n", (long)bytes_written); +#endif + va_end(ap); + va_start(ap, format); + +#if 0 + printf("Result: bytes_written=%ld, OUTBUFF_SIZE-outBuffOffset=%ld\n", (long)bytes_written, (long)OUTBUFF_SIZE-outBuffOffset); +#endif + + if ((bytes_written < 0) || +#ifdef H5_VSNPRINTF_WORKS + (bytes_written >= (OUTBUFF_SIZE-outBuffOffset)) +#else + ((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset)) +#endif + ) + { + /* Terminate the outbuff at the end of the previous output */ + outBuff[outBuffOffset] = '\0'; + + overflow_file = HDtmpfile(); + if(overflow_file == NULL) + fprintf(stderr, "warning: could not create overflow file. Output may be truncated.\n"); + else + bytes_written = HDvfprintf(overflow_file, format, ap); + } + else + outBuffOffset += bytes_written; + } + else + bytes_written = HDvfprintf(overflow_file, format, ap); + + } + va_end(ap); +} + /*------------------------------------------------------------------------- * Function: error_msg @@ -66,13 +138,13 @@ static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t *------------------------------------------------------------------------- */ void -error_msg(const char *progname, const char *fmt, ...) +error_msg(const char *fmt, ...) { va_list ap; va_start(ap, fmt); HDfflush(stdout); - HDfprintf(stderr, "%s error: ", progname); + HDfprintf(stderr, "%s error: ", h5tools_getprogname()); HDvfprintf(stderr, fmt, ap); va_end(ap); @@ -95,13 +167,13 @@ error_msg(const char *progname, const char *fmt, ...) *------------------------------------------------------------------------- */ void -warn_msg(const char *progname, const char *fmt, ...) +warn_msg(const char *fmt, ...) { va_list ap; va_start(ap, fmt); HDfflush(stdout); - HDfprintf(stderr, "%s warning: ", progname); + HDfprintf(stderr, "%s warning: ", h5tools_getprogname()); HDvfprintf(stderr, fmt, ap); va_end(ap); } @@ -591,7 +663,7 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record) /* See if we need to make table larger */ if(table->nobjs == table->size) { table->size *= 2; - table->objs = HDrealloc(table->objs, table->size * sizeof(table->objs[0])); + table->objs = (struct obj_t *)HDrealloc(table->objs, table->size * sizeof(table->objs[0])); } /* end if */ /* Increment number of objects in table */ @@ -690,7 +762,7 @@ H5tools_get_link_info(hid_t file_id, const char * linkpath, h5tool_link_info_t * HDassert(link_info->trg_path); /* get link value */ - if(H5Lget_val(file_id, linkpath, link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0) { + if(H5Lget_val(file_id, linkpath, (void *)link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: unable to get link value from <%s>\n",linkpath); goto out; @@ -769,12 +841,12 @@ void h5tools_setstatus(int D_status) h5tools_d_status = D_status; } -const char*h5tools_getprogname() +const char*h5tools_getprogname(void) { return h5tools_progname; } -int h5tools_getstatus() +int h5tools_getstatus(void) { return h5tools_d_status; } diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 9e0b0d0..82a5a02 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -28,6 +28,10 @@ extern "C" { #endif +/* ``parallel_print'' information */ +#define PRINT_DATA_MAX_SIZE 512 +#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4) + /* * begin get_option section */ @@ -110,8 +114,9 @@ H5TOOLS_DLLVAR int nCols; /*max number of columns for outputti /* Definitions of useful routines */ H5TOOLS_DLL void indentation(int); H5TOOLS_DLL void print_version(const char *progname); -H5TOOLS_DLL void error_msg(const char *progname, const char *fmt, ...); -H5TOOLS_DLL void warn_msg(const char *progname, const char *fmt, ...); +H5TOOLS_DLL void parallel_print(const char* format, ... ); +H5TOOLS_DLL void error_msg(const char *fmt, ...); +H5TOOLS_DLL void warn_msg(const char *fmt, ...); H5TOOLS_DLL void free_table(table_t *table); #ifdef H5DUMP_DEBUG H5TOOLS_DLL void dump_tables(find_objs_t *info) diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h index 65e2132..b6e2c44 100644 --- a/tools/lib/ph5diff.h +++ b/tools/lib/ph5diff.h @@ -16,8 +16,6 @@ #ifndef _PH5DIFF_H__ #define _PH5DIFF_H__ -#define PRINT_DATA_MAX_SIZE 512 -#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4) /* Send from manager to workers */ #define MPI_TAG_ARGS 1 #define MPI_TAG_PRINT_TOK 2 diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c index eb3d3f0..09f23ef 100644 --- a/tools/misc/h5mkgrp.c +++ b/tools/misc/h5mkgrp.c @@ -153,7 +153,7 @@ parse_command_line(int argc, const char *argv[], param_t *params) /* Check for file name to be processed */ if(argc <= opt_ind) { - error_msg(h5tools_getprogname(), "missing file name\n"); + error_msg("missing file name\n"); usage(); leave(EXIT_FAILURE); } /* end if */ @@ -164,7 +164,7 @@ parse_command_line(int argc, const char *argv[], param_t *params) /* Check for group(s) to be created */ if(argc <= opt_ind) { - error_msg(h5tools_getprogname(), "missing group name(s)\n"); + error_msg("missing group name(s)\n"); usage(); leave(EXIT_FAILURE); } /* end if */ @@ -224,13 +224,13 @@ main(int argc, const char *argv[]) /* Parse command line */ HDmemset(¶ms, 0, sizeof(params)); if(parse_command_line(argc, argv, ¶ms) < 0) { - error_msg(h5tools_getprogname(), "unable to parse command line arguments\n"); + error_msg("unable to parse command line arguments\n"); leave(EXIT_FAILURE); } /* end if */ /* Create file access property list */ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - error_msg(h5tools_getprogname(), "Could not create file access property list\n"); + error_msg("Could not create file access property list\n"); leave(EXIT_FAILURE); } /* end if */ @@ -238,7 +238,7 @@ main(int argc, const char *argv[]) if(params.latest) { /* Set the "use the latest version of the format" bounds */ if(H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { - error_msg(h5tools_getprogname(), "Could not set property for using latest version of the format\n"); + error_msg("Could not set property for using latest version of the format\n"); leave(EXIT_FAILURE); } /* end if */ @@ -257,13 +257,13 @@ main(int argc, const char *argv[]) /* Test for error in opening file */ if(fid < 0) { - error_msg(h5tools_getprogname(), "Could not open output file '%s'\n", params.fname); + error_msg("Could not open output file '%s'\n", params.fname); leave(EXIT_FAILURE); } /* end if */ /* Create link creation property list */ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) { - error_msg(h5tools_getprogname(), "Could not create link creation property list\n"); + error_msg("Could not create link creation property list\n"); leave(EXIT_FAILURE); } /* end if */ @@ -271,7 +271,7 @@ main(int argc, const char *argv[]) if(params.parents) { /* Set the intermediate group creation property */ if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) { - error_msg(h5tools_getprogname(), "Could not set property for creating parent groups\n"); + error_msg("Could not set property for creating parent groups\n"); leave(EXIT_FAILURE); } /* end if */ @@ -286,13 +286,13 @@ main(int argc, const char *argv[]) /* Attempt to create a group */ if((gid = H5Gcreate2(fid, params.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - error_msg(h5tools_getprogname(), "Could not create group '%s'\n", params.groups[curr_group]); + error_msg("Could not create group '%s'\n", params.groups[curr_group]); leave(EXIT_FAILURE); } /* end if */ /* Close the group */ if(H5Gclose(gid) < 0) { - error_msg(h5tools_getprogname(), "Could not close group '%s'??\n", params.groups[curr_group]); + error_msg("Could not close group '%s'??\n", params.groups[curr_group]); leave(EXIT_FAILURE); } /* end if */ @@ -303,19 +303,19 @@ main(int argc, const char *argv[]) /* Close link creation property list */ if(H5Pclose(lcpl_id) < 0) { - error_msg(h5tools_getprogname(), "Could not close link creation property list\n"); + error_msg("Could not close link creation property list\n"); leave(EXIT_FAILURE); } /* end if */ /* Close file */ if(H5Fclose(fid) < 0) { - error_msg(h5tools_getprogname(), "Could not close output file '%s'??\n", params.fname); + error_msg("Could not close output file '%s'??\n", params.fname); leave(EXIT_FAILURE); } /* end if */ /* Close file access property list */ if(H5Pclose(fapl_id) < 0) { - error_msg(h5tools_getprogname(), "Could not close file access property list\n"); + error_msg("Could not close file access property list\n"); leave(EXIT_FAILURE); } /* end if */ diff --git a/tools/testfiles/tbinregR.txt b/tools/testfiles/tbinregR.txt new file mode 100644 index 0000000..f4c38a1 --- /dev/null +++ b/tools/testfiles/tbinregR.txt @@ -0,0 +1,15 @@ +HDF5 "tdatareg.h5" { +DATASET "/Dataset1" { + DATATYPE H5T_REFERENCE + DATASPACE SIMPLE { ( 4 ) / ( 4 ) } + SUBSET { + START ( 0 ); + STRIDE ( 1 ); + COUNT ( 1 ); + BLOCK ( 1 ); + DATA { + + } + } +} +} diff --git a/tools/testfiles/texceedsubblock.ddl b/tools/testfiles/texceedsubblock.ddl new file mode 100644 index 0000000..499e0d2 --- /dev/null +++ b/tools/testfiles/texceedsubblock.ddl @@ -0,0 +1,3 @@ +HDF5 "taindices.h5" { +} +h5dump error: number of block dims (2) exceed dataset dims (1) diff --git a/tools/testfiles/texceedsubcount.ddl b/tools/testfiles/texceedsubcount.ddl new file mode 100644 index 0000000..81e8c4a --- /dev/null +++ b/tools/testfiles/texceedsubcount.ddl @@ -0,0 +1,3 @@ +HDF5 "taindices.h5" { +} +h5dump error: number of count dims (2) exceed dataset dims (1) diff --git a/tools/testfiles/texceedsubstart.ddl b/tools/testfiles/texceedsubstart.ddl new file mode 100644 index 0000000..cb535a0 --- /dev/null +++ b/tools/testfiles/texceedsubstart.ddl @@ -0,0 +1,3 @@ +HDF5 "taindices.h5" { +} +h5dump error: number of start dims (2) exceed dataset dims (1) diff --git a/tools/testfiles/texceedsubstride.ddl b/tools/testfiles/texceedsubstride.ddl new file mode 100644 index 0000000..bf85997 --- /dev/null +++ b/tools/testfiles/texceedsubstride.ddl @@ -0,0 +1,3 @@ +HDF5 "taindices.h5" { +} +h5dump error: number of stride dims (2) exceed dataset dims (1) |