diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2012-02-28 18:26:34 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2012-02-28 18:26:34 (GMT) |
commit | df6c92e506a81ed0ede7dacc1269d21ae3e0f411 (patch) | |
tree | c67a1ca1bb197289bd955ca4065f0c611dbcdf6e /tools | |
parent | 9423da6a4d53cb2eb6c48a9e0d254307bbf8ae9b (diff) | |
download | hdf5-df6c92e506a81ed0ede7dacc1269d21ae3e0f411.zip hdf5-df6c92e506a81ed0ede7dacc1269d21ae3e0f411.tar.gz hdf5-df6c92e506a81ed0ede7dacc1269d21ae3e0f411.tar.bz2 |
[svn-r22004] Reduced warnings and fixed conflicts resulting from including h5tools.h
Tested: local linux
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5copy/h5copy.c | 4 | ||||
-rw-r--r-- | tools/h5diff/h5diff_common.c | 5 | ||||
-rw-r--r-- | tools/h5diff/h5diff_main.c | 1 | ||||
-rw-r--r-- | tools/h5diff/ph5diff_main.c | 1 | ||||
-rwxr-xr-x | tools/h5import/h5import.c | 9 | ||||
-rwxr-xr-x | tools/h5import/h5import.h | 2 | ||||
-rw-r--r-- | tools/h5jam/getub.c | 1 | ||||
-rw-r--r-- | tools/h5jam/h5jam.c | 1 | ||||
-rw-r--r-- | tools/h5jam/h5unjam.c | 1 | ||||
-rw-r--r-- | tools/h5jam/tellub.c | 1 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 4 | ||||
-rw-r--r-- | tools/h5repack/h5repack.c | 30 | ||||
-rw-r--r-- | tools/h5repack/h5repack_main.c | 1 | ||||
-rw-r--r-- | tools/h5repack/h5repack_opttable.c | 1 | ||||
-rw-r--r-- | tools/h5repack/h5repack_parse.c | 1 | ||||
-rw-r--r-- | tools/h5repack/h5repack_refs.c | 242 | ||||
-rw-r--r-- | tools/h5repack/h5repack_verify.c | 15 | ||||
-rw-r--r-- | tools/h5repack/testh5repack_detect_szip.c | 1 | ||||
-rw-r--r-- | tools/lib/h5diff.c | 44 |
19 files changed, 189 insertions, 176 deletions
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c index 1a9a8eb..574ba94 100644 --- a/tools/h5copy/h5copy.c +++ b/tools/h5copy/h5copy.c @@ -465,7 +465,7 @@ main (int argc, const char *argv[]) /* free link info path */ if (linkinfo.trg_path) - HDfree(linkinfo.trg_path); + HDfree((char*)linkinfo.trg_path); /* close propertis */ if(H5Pclose(ocpl_id)<0) @@ -497,7 +497,7 @@ error: /* free link info path */ if (linkinfo.trg_path) - HDfree(linkinfo.trg_path); + HDfree((char*)linkinfo.trg_path); H5E_BEGIN_TRY { H5Pclose(ocpl_id); diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index f7532f2..b8e46f3 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -17,6 +17,7 @@ #include <string.h> #include "h5diff.h" #include "h5diff_common.h" +#include "h5tools.h" #include "h5tools_utils.h" static int check_n_input( const char* ); @@ -53,7 +54,7 @@ static struct long_options l_opts[] = { * *------------------------------------------------------------------------- */ -static check_options(diff_opt_t* options) +static void check_options(diff_opt_t* options) { /*-------------------------------------------------------------- * check for mutually exclusive options @@ -179,7 +180,7 @@ void parse_command_line(int argc, } /* init */ - exclude_node->obj_path = opt_arg; + exclude_node->obj_path = (char*)opt_arg; exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN; exclude_prev = exclude_head; diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index 51a49c2..607d58e 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -18,6 +18,7 @@ #include <memory.h> #include "h5diff.h" #include "h5diff_common.h" +#include "h5tools.h" #include "h5tools_utils.h" diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c index 5bd5567..1fc563b 100644 --- a/tools/h5diff/ph5diff_main.c +++ b/tools/h5diff/ph5diff_main.c @@ -19,6 +19,7 @@ #include <string.h> #include <assert.h> #include "h5diff_common.h" +#include "h5tools.h" #include "h5tools_utils.h" /* Name of tool */ diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index 89701bd..56dc5ab 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -20,6 +20,7 @@ #include <string.h> #include <ctype.h> #include "h5import.h" +#include "h5tools.h" #include "h5tools_utils.h" /* Name of tool */ @@ -1361,7 +1362,7 @@ static int processConfigurationFile(char *infile, struct Input *in) break; case 12: /* EXTERNAL-STORAGE */ - if (in->configOptionVector[EXTERNAL] == 1) { + if (in->configOptionVector[EXTERNALSTORE] == 1) { (void) HDfprintf(stderr, err15a, infile); HDfclose(strm); return (-1); @@ -1372,7 +1373,7 @@ static int processConfigurationFile(char *infile, struct Input *in) HDfclose(strm); return (-1); } - in->configOptionVector[EXTERNAL] = 1; + in->configOptionVector[EXTERNALSTORE] = 1; break; case 13: /* MAXIMUM-DIMENSIONS */ @@ -1435,7 +1436,7 @@ static int validateConfigurationParameters(struct Input *in) return (-1); } - if (in->configOptionVector[EXTERNAL] == 1) { + if (in->configOptionVector[EXTERNALSTORE] == 1) { if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[CHUNK] == 1) || (in->configOptionVector[EXTEND] == 1)) { (void) HDfprintf(stderr, "%s", err2); return (-1); @@ -2360,7 +2361,7 @@ static int process(struct Options *opt) H5Pset_deflate(proplist, (unsigned) in->compressionParam); } - if (in->configOptionVector[EXTERNAL] == 1) { + if (in->configOptionVector[EXTERNALSTORE] == 1) { /* creating the external file if it doesnt exist */ if ((extfile = HDfopen(in->externFilename, "ab")) == NULL) { (void) HDfprintf(stderr, "%s", err4); diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h index 05de476..dbc6844 100755 --- a/tools/h5import/h5import.h +++ b/tools/h5import/h5import.h @@ -47,7 +47,7 @@ #define CHUNK 0 #define COMPRESS 1 #define EXTEND 2 -#define EXTERNAL 3 +#define EXTERNALSTORE 3 #define DIM 4 #define RANK 5 #define PATH 6 diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c index 39a78ae..f536605 100644 --- a/tools/h5jam/getub.c +++ b/tools/h5jam/getub.c @@ -21,6 +21,7 @@ #endif #include "H5private.h" +#include "h5tools.h" #include "h5tools_utils.h" void parse_command_line (int argc, const char *argv[]); diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index 923bc5a..981eead 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -15,6 +15,7 @@ #include "hdf5.h" #include "H5private.h" +#include "h5tools.h" #include "h5tools_utils.h" /* Name of tool */ diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index 1dfdfc7..4751dad 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -15,6 +15,7 @@ #include "hdf5.h" #include "H5private.h" +#include "h5tools.h" #include "h5tools_utils.h" /* Name of tool */ diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c index 2ffcbda..0169d71 100644 --- a/tools/h5jam/tellub.c +++ b/tools/h5jam/tellub.c @@ -21,6 +21,7 @@ #include "hdf5.h" #include "H5private.h" +#include "h5tools.h" #include "h5tools_utils.h" #define TRUE 1 diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 3e335e9..7315796 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -3127,7 +3127,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) ret = H5tools_get_symlink_info(iter->fid, name, &lnk_info, follow_symlink_g); /* lnk_info.trg_path is malloced in H5tools_get_symlink_info() * so it will be freed via buf later */ - buf = lnk_info.trg_path; + buf = (char*)lnk_info.trg_path; /* error */ if (ret < 0) goto done; @@ -3185,7 +3185,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) ret = H5tools_get_symlink_info(iter->fid, name, &lnk_info, follow_link); /* lnk_info.trg_path is malloced in H5tools_get_symlink_info() * so it will be freed via buf later */ - buf = lnk_info.trg_path; + buf = (char*)lnk_info.trg_path; /* error */ if (ret < 0) goto done; diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index b36eb37..28d66c5 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -493,24 +493,24 @@ int copy_attr(hid_t loc_in, type_class = H5Tget_class(wtype_id); is_ref = (type_class == H5T_REFERENCE); if (type_class == H5T_VLEN ||type_class == H5T_ARRAY ) { - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - is_ref = (is_ref || (H5Tget_class(base_type)==H5T_REFERENCE)); - H5Tclose(base_type); + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + is_ref = (is_ref || (H5Tget_class(base_type)==H5T_REFERENCE)); + H5Tclose(base_type); } if (type_class == H5T_COMPOUND) { - int nmembers = H5Tget_nmembers(wtype_id) ; - for (j=0; j<nmembers; j++) { - hid_t mtid = H5Tget_member_type( wtype_id, j ); - H5T_class_t mtclass = H5Tget_class(mtid); - H5Tclose(mtid); - - if (mtclass==H5T_REFERENCE) { - is_ref = 1; - break; - } - } /* for (j=0; i<nmembers; j++) */ + int nmembers = H5Tget_nmembers(wtype_id) ; + for (j=0; j<nmembers; j++) { + hid_t mtid = H5Tget_member_type( wtype_id, j ); + H5T_class_t mtclass = H5Tget_class(mtid); + H5Tclose(mtid); + + if (mtclass==H5T_REFERENCE) { + is_ref = 1; + break; + } + } /* for (j=0; i<nmembers; j++) */ } /* if (type_class == H5T_COMPOUND) */ if(is_ref) { diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 15b57b0..720e8d6 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -13,6 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include "h5tools.h" #include "h5tools_utils.h" #include "h5repack.h" diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index b1a3469..d0fcff3 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -14,6 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" +#include "h5tools.h" #include "h5tools_utils.h" /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 910b182..70eadd2 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -14,6 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" +#include "h5tools.h" #include "h5tools_utils.h" /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 915b0e9..7108491 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -28,7 +28,7 @@ static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt); static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options, trav_table_t *travt, hid_t fidout); static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, - hid_t fid_out, void *ref_out, trav_table_t *travt); + hid_t fid_out, void *ref_out, trav_table_t *travt); /*------------------------------------------------------------------------- * Function: do_copy_refobjs @@ -432,13 +432,13 @@ error: * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Modifier: xcao@hdfgroup.org, 9/12/2011 - * Update values of references(object and region) for the following types: + * Update values of references(object and region) for the following types: * 1) References, * 2) ARRAY of reference, * 3) VLEN of references. * 4) COMPOUND of references. * This function does not handle references in other complicated structures, - * such as references in nested compound datatypes. + * such as references in nested compound datatypes. * * Date: October, 28, 2003 * @@ -479,7 +479,7 @@ static int copy_refs_attr(hid_t loc_in, for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { - is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0; + is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0; /* open attribute */ if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -500,39 +500,39 @@ static int copy_refs_attr(hid_t loc_in, is_ref = (type_class == H5T_REFERENCE); if (type_class == H5T_VLEN ) { - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - is_ref_vlen = (H5Tget_class(base_type)==H5T_REFERENCE); - msize = H5Tget_size(base_type); - H5Tclose(base_type); + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + is_ref_vlen = (H5Tget_class(base_type)==H5T_REFERENCE); + msize = H5Tget_size(base_type); + H5Tclose(base_type); } if (type_class == H5T_ARRAY ) { - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - is_ref_array = (H5Tget_class(base_type)==H5T_REFERENCE); - msize = H5Tget_size(base_type); - H5Tclose(base_type); + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + is_ref_array = (H5Tget_class(base_type)==H5T_REFERENCE); + msize = H5Tget_size(base_type); + H5Tclose(base_type); } if (type_class == H5T_COMPOUND) { - int nmembers = H5Tget_nmembers(ftype_id) ; - if (nmembers < 1) - goto error; + int nmembers = H5Tget_nmembers(ftype_id) ; + if (nmembers < 1) + goto error; ref_comp_index = (int *)HDmalloc(nmembers*sizeof (int)); ref_comp_size = (size_t *)HDmalloc(nmembers*sizeof(ref_comp_size)); ref_comp_field_n = 0; - for (i=0; i<(unsigned)nmembers; i++) { - hid_t mtid = H5Tget_member_type( ftype_id, i ); - if ((H5Tget_class(mtid)==H5T_REFERENCE)) { - ref_comp_index[ref_comp_field_n] = i; - ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid); - ref_comp_field_n++; - } - H5Tclose(mtid); - } + for (i=0; i<(unsigned)nmembers; i++) { + hid_t mtid = H5Tget_member_type( ftype_id, i ); + if ((H5Tget_class(mtid)==H5T_REFERENCE)) { + ref_comp_index[ref_comp_field_n] = i; + ref_comp_size[ref_comp_field_n] = H5Tget_size(mtid); + ref_comp_field_n++; + } + H5Tclose(mtid); + } /* if compound don't contain reference type member, free the above * mallocs. Otherwise there can be memory leaks by the 'continue' @@ -541,14 +541,14 @@ static int copy_refs_attr(hid_t loc_in, { if (ref_comp_index) { - HDfree(ref_comp_index); - ref_comp_index = NULL; + HDfree(ref_comp_index); + ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); - ref_comp_size = NULL; + HDfree(ref_comp_size); + ref_comp_size = NULL; } } } @@ -556,10 +556,10 @@ static int copy_refs_attr(hid_t loc_in, is_ref_comp = (ref_comp_field_n > 0); if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) { - H5Tclose(mtype_id); - H5Tclose(ftype_id); - H5Aclose(attr_id); - continue; + H5Tclose(mtype_id); + H5Tclose(ftype_id); + H5Aclose(attr_id); + continue; } /* get name */ @@ -584,18 +584,18 @@ static int copy_refs_attr(hid_t loc_in, nelmts *= dims[j]; if (is_ref_array) { - unsigned array_rank = 0; - hsize_t array_size = 1; - hsize_t array_dims[H5S_MAX_RANK]; - hid_t base_type = -1; - base_type = H5Tget_super(ftype_id); - msize = H5Tget_size(base_type); - H5Tclose(base_type); - - array_rank = H5Tget_array_ndims(mtype_id); - H5Tget_array_dims2(mtype_id, array_dims); + unsigned array_rank = 0; + hsize_t array_size = 1; + hsize_t array_dims[H5S_MAX_RANK]; + hid_t base_type = -1; + base_type = H5Tget_super(ftype_id); + msize = H5Tget_size(base_type); + H5Tclose(base_type); + + array_rank = H5Tget_array_ndims(mtype_id); + H5Tget_array_dims2(mtype_id, array_dims); for(j = 0; j <array_rank; j++) - array_size *= array_dims[j]; + array_size *= array_dims[j]; nelmts *= array_size; } @@ -626,7 +626,7 @@ static int copy_refs_attr(hid_t loc_in, for(i = 0; i < (unsigned)nelmts; i++) { if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt)<0) - continue; + continue; if(options->verbose) printf("object <%s> reference created to <%s>\n", name, refname); } /* k */ @@ -657,13 +657,13 @@ static int copy_refs_attr(hid_t loc_in, for(i = 0; i < (unsigned)nelmts; i++) { if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt)<0) - continue; + continue; if(options->verbose) printf("object <%s> region reference created to <%s>\n", name, refname); } } /* H5T_STD_REF_DSETREG */ else if (is_ref_vlen) { - /* handle VLEN of references */ + /* handle VLEN of references */ buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t))); refbuf = buf; /* reuse the read buffer for write */ @@ -677,31 +677,31 @@ static int copy_refs_attr(hid_t loc_in, if(H5Aread(attr_id, mtype_id, buf) < 0) goto error; - if (H5R_OBJ_REF_BUF_SIZE==msize) { - hobj_ref_t ref_out; - for (i=0; i<(unsigned)nelmts; i++) { - hobj_ref_t *ptr = (hobj_ref_t *)((hvl_t *)buf)[i].p; - for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { - if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(&(ptr[j]), &ref_out, msize); - } - } /* for (i=0; i<nelems; i++) */ - } else if (H5R_DSET_REG_REF_BUF_SIZE == msize) { - - hdset_reg_ref_t ref_out; - for (i=0; i<(unsigned)nelmts; i++) { - hdset_reg_ref_t *ptr = (hdset_reg_ref_t *)((hvl_t *)buf)[i].p; - for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { - if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(&(ptr[j]), &ref_out, msize); - } - } /* for (i=0; i<nelems; i++) */ - } + if (H5R_OBJ_REF_BUF_SIZE==msize) { + hobj_ref_t ref_out; + for (i=0; i<(unsigned)nelmts; i++) { + hobj_ref_t *ptr = (hobj_ref_t *)((hvl_t *)buf)[i].p; + for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { + if (update_ref_value(attr_id, H5R_OBJECT, &(ptr[j]), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(&(ptr[j]), &ref_out, msize); + } + } /* for (i=0; i<nelems; i++) */ + } else if (H5R_DSET_REG_REF_BUF_SIZE == msize) { + + hdset_reg_ref_t ref_out; + for (i=0; i<(unsigned)nelmts; i++) { + hdset_reg_ref_t *ptr = (hdset_reg_ref_t *)((hvl_t *)buf)[i].p; + for (j=0; j<((hvl_t *)buf)[i].len; j++ ) { + if (update_ref_value(attr_id, H5R_DATASET_REGION, &(ptr[j]), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(&(ptr[j]), &ref_out, msize); + } + } /* for (i=0; i<nelems; i++) */ + } } /* else if (is_ref_vlen) */ else if (is_ref_comp) { - /* handle ref fields in a compound */ + /* handle ref fields in a compound */ buf = HDmalloc((unsigned)(nelmts * msize)); refbuf = buf; /* reuse the read buffer for write */ @@ -716,22 +716,22 @@ static int copy_refs_attr(hid_t loc_in, goto error; for (i=0; i<(unsigned)nelmts; i++) { - for (j=0; j<(unsigned)ref_comp_field_n; j++) { - if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) { - int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); - hobj_ref_t ref_out; - if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); - } /* if */ - else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) { - int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); - hdset_reg_ref_t ref_out; - if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) - continue; - HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); - } /* else if */ - } /* j */ + for (j=0; j<(unsigned)ref_comp_field_n; j++) { + if (ref_comp_size[j] == H5R_OBJ_REF_BUF_SIZE) { + int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); + hobj_ref_t ref_out; + if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); + } /* if */ + else if (ref_comp_size[j] == H5R_DSET_REG_REF_BUF_SIZE) { + int idx = i*msize+H5Tget_member_offset( mtype_id, (unsigned)ref_comp_index[j]); + hdset_reg_ref_t ref_out; + if (update_ref_value(attr_id, H5R_DATASET_REGION, (hdset_reg_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) + continue; + HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); + } /* else if */ + } /* j */ } /* i */ } /* else if (is_ref_comp) */ @@ -739,11 +739,11 @@ static int copy_refs_attr(hid_t loc_in, goto error; if (is_ref_vlen && buf) - H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf); + H5Dvlen_reclaim (mtype_id, space_id, H5P_DEFAULT, buf); } /* if (nelmts) */ if (refbuf == buf) - refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */ + refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */ if(buf) { HDfree(buf); @@ -756,13 +756,13 @@ static int copy_refs_attr(hid_t loc_in, } if (ref_comp_index) { - HDfree(ref_comp_index); - ref_comp_index = NULL; + HDfree(ref_comp_index); + ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); - ref_comp_size = NULL; + HDfree(ref_comp_size); + ref_comp_size = NULL; } if(H5Aclose(attr_out) < 0) @@ -785,16 +785,16 @@ static int copy_refs_attr(hid_t loc_in, return 0; error: - if(refbuf) - HDfree(refbuf); - if(buf) - HDfree(buf); + if(refbuf) + HDfree(refbuf); + if(buf) + HDfree(buf); if (ref_comp_index) - HDfree(ref_comp_index); + HDfree(ref_comp_index); if (ref_comp_size) - HDfree(ref_comp_size); + HDfree(ref_comp_size); H5E_BEGIN_TRY { H5Tclose(ftype_id); @@ -808,9 +808,9 @@ error: } /*------------------------------------------------------------------------- - * Function: MapIdToName + * Function: MapIdToName * - * Purpose: map a ID from a reference to a dataset name + * Purpose: map a ID from a reference to a dataset name * *------------------------------------------------------------------------- */ @@ -843,41 +843,41 @@ out: } /*------------------------------------------------------------------------- - * Function: Update_Ref_value + * Function: Update_Ref_value * - * Purpose: Update a reference value + * Purpose: Update a reference value * * Programmer: xcao@hdfgroup.org 9/12/2011 * *------------------------------------------------------------------------- */ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, - hid_t fid_out, void *ref_out, trav_table_t *travt) + hid_t fid_out, void *ref_out, trav_table_t *travt) { - herr_t ret = -1; - const char* ref_obj_name; - hid_t space_id=-1, ref_obj_id=-1; + herr_t ret = -1; + const char* ref_obj_name; + hid_t space_id=-1, ref_obj_id=-1; - ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in); - if (ref_obj_id<0) - goto done; + ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in); + if (ref_obj_id<0) + goto done; - ref_obj_name = MapIdToName(ref_obj_id, travt); - if (ref_obj_name == NULL) - goto done; + ref_obj_name = MapIdToName(ref_obj_id, travt); + if (ref_obj_name == NULL) + goto done; - if (ref_type == H5R_DATASET_REGION) { - space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in); - if (space_id < 0) - goto done; - } + if (ref_type == H5R_DATASET_REGION) { + space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in); + if (space_id < 0) + goto done; + } ret = H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id); if (ret < 0) - goto done; + goto done; - ret = 0; + ret = 0; done: H5E_BEGIN_TRY { @@ -885,6 +885,6 @@ done: H5Oclose(ref_obj_id); } H5E_END_TRY; - return ret; + return ret; } diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index b0ab1d1..47cba5b 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -14,16 +14,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5repack.h" +#include "h5tools.h" #include "h5tools_utils.h" -static int verify_layout(hid_t pid, pack_info_t *obj); -static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter); - /* number of members in an array */ #ifndef NELMTS -# define NELMTS(X) (sizeof(X)/sizeof(X[0])) +# define NELMTS(X) (sizeof(X)/sizeof(X[0])) #endif +static int verify_layout(hid_t pid, pack_info_t *obj); +static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter); + /*------------------------------------------------------------------------- * Function: h5repack_verify @@ -301,9 +302,9 @@ error: * * Purpose: verify which layout is present in the property list DCPL_ID * - * H5D_COMPACT = 0 - * H5D_CONTIGUOUS = 1 - * H5D_CHUNKED = 2 + * H5D_COMPACT = 0 + * H5D_CONTIGUOUS = 1 + * H5D_CHUNKED = 2 * * Return: 1 has, 0 does not, -1 error * diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c index 0a6a77a..e91b2f7 100644 --- a/tools/h5repack/testh5repack_detect_szip.c +++ b/tools/h5repack/testh5repack_detect_szip.c @@ -16,6 +16,7 @@ #include <stdio.h> #include "h5repack.h" #include "h5tools.h" +#include "h5tools_utils.h" #include "h5test.h" diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index f86e914..bc8acd5 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -614,7 +614,7 @@ static herr_t trav_grp_symlinks(const char *path, const H5L_info_t *linfo, done: if (lnk_info.trg_path) - HDfree(lnk_info.trg_path); + HDfree((char *)lnk_info.trg_path); return 0; } @@ -728,25 +728,25 @@ hsize_t h5diff(const char *fname1, /* make the given object1 fullpath, start with "/" */ if (HDstrncmp(objname1, "/", 1)) { - HDstrcpy(obj1fullname, "/"); - HDstrcat(obj1fullname, objname1); + HDstrcpy((char *)obj1fullname, "/"); + HDstrcat((char *)obj1fullname, objname1); } else - HDstrcpy(obj1fullname, objname1); + HDstrcpy((char *)obj1fullname, objname1); /* make the given object2 fullpath, start with "/" */ if (HDstrncmp(objname2, "/", 1)) { - HDstrcpy(obj2fullname, "/"); - HDstrcat(obj2fullname, objname2); + HDstrcpy((char *)obj2fullname, "/"); + HDstrcat((char *)obj2fullname, objname2); } else - HDstrcpy(obj2fullname, objname2); + HDstrcpy((char *)obj2fullname, objname2); /*---------------------------------------------------------- * check if obj1 is root, group, single object or symlink */ - if(!HDstrcmp(obj1fullname, "/")) + if(!HDstrcmp((char *)obj1fullname, "/")) { obj1type = H5TRAV_TYPE_GROUP; } @@ -856,9 +856,9 @@ hsize_t h5diff(const char *fname1, { /* set root group */ obj1fullname = (char*)HDcalloc(2, sizeof(char)); - HDstrcat(obj1fullname, "/"); + HDstrcat((char *)obj1fullname, "/"); obj2fullname = (char*)HDcalloc(2, sizeof(char)); - HDstrcat(obj2fullname, "/"); + HDstrcat((char *)obj2fullname, "/"); } @@ -1045,15 +1045,15 @@ out: /* free buffers */ if (obj1fullname) - HDfree(obj1fullname); + HDfree((char *)obj1fullname); if (obj2fullname) - HDfree(obj2fullname); + HDfree((char *)obj2fullname); /* free link info buffer */ if (trg_linfo1.trg_path) - HDfree(trg_linfo1.trg_path); + HDfree((char *)trg_linfo1.trg_path); if (trg_linfo2.trg_path) - HDfree(trg_linfo2.trg_path); + HDfree((char *)trg_linfo2.trg_path); /* close */ H5E_BEGIN_TRY @@ -1112,9 +1112,9 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, * make full path */ if (HDstrcmp (grp1, "/")) - grp1_path = grp1; + grp1_path = (char *)grp1; if (HDstrcmp (grp2, "/")) - grp2_path = grp2; + grp2_path = (char *)grp2; /*------------------------------------------------------------------------- * regarding the return value of h5diff (0, no difference in files, 1 difference ) @@ -1769,9 +1769,9 @@ out: /* free link info buffer */ if (linkinfo1.trg_path) - HDfree(linkinfo1.trg_path); + HDfree((char *)linkinfo1.trg_path); if (linkinfo2.trg_path) - HDfree(linkinfo2.trg_path); + HDfree((char *)linkinfo2.trg_path); return nfound; } @@ -2163,9 +2163,9 @@ hsize_t diff(hid_t file1_id, /* free link info buffer */ if (linkinfo1.trg_path) - HDfree(linkinfo1.trg_path); + HDfree((char *)linkinfo1.trg_path); if (linkinfo2.trg_path) - HDfree(linkinfo2.trg_path); + HDfree((char *)linkinfo2.trg_path); return nfound; @@ -2206,9 +2206,9 @@ out2: /* free link info buffer */ if (linkinfo1.trg_path) - HDfree(linkinfo1.trg_path); + HDfree((char *)linkinfo1.trg_path); if (linkinfo2.trg_path) - HDfree(linkinfo2.trg_path); + HDfree((char *)linkinfo2.trg_path); /* close */ /* disable error reporting */ |