diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2013-09-13 21:11:30 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2013-09-13 21:11:30 (GMT) |
commit | a8c63e28d570c1eea5a23b9ed684efb4cd24e3ba (patch) | |
tree | a501ac6a79670c132cad11386a819ffaea570945 | |
parent | 3c021d3a7775df18247de19cee3805178cd2666c (diff) | |
download | hdf5-a8c63e28d570c1eea5a23b9ed684efb4cd24e3ba.zip hdf5-a8c63e28d570c1eea5a23b9ed684efb4cd24e3ba.tar.gz hdf5-a8c63e28d570c1eea5a23b9ed684efb4cd24e3ba.tar.bz2 |
[svn-r24138] Cast constants to specified type.
Cast smaller vars to larger type.
Cast calculation result to correct type.
Changed int member to hbool_t
Tested: local linux
-rw-r--r-- | tools/h5diff/h5diff_common.c | 7 | ||||
-rw-r--r-- | tools/lib/h5diff.c | 14 | ||||
-rw-r--r-- | tools/lib/h5diff.h | 2 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 10 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 12 | ||||
-rw-r--r-- | tools/lib/h5tools_filters.c | 2 |
6 files changed, 24 insertions, 23 deletions
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index b8e46f3..cf46e74 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -15,6 +15,7 @@ #include <stdlib.h> #include <string.h> +#include "H5private.h" #include "h5diff.h" #include "h5diff_common.h" #include "h5tools.h" @@ -135,7 +136,7 @@ void parse_command_line(int argc, options->m_verbose_level = 0; break; } - else if (!strncmp (argv[i], "-v", 2)) + else if (!strncmp (argv[i], "-v", (size_t)2)) { options->m_verbose_level = atoi(&argv[i][2]); break; @@ -149,7 +150,7 @@ void parse_command_line(int argc, options->m_verbose_level = 0; break; } - else if ( !strncmp (argv[i], "--verbose", 9) && argv[i][9]=='=') + else if ( !strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=') { options->m_verbose_level = atoi(&argv[i][10]); break; @@ -164,7 +165,7 @@ void parse_command_line(int argc, options->m_report = 1; break; case 'l': - options->follow_links = 1; + options->follow_links = TRUE; break; case 'x': options->no_dangle_links = 1; diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 1752155..541525d 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -839,10 +839,10 @@ hsize_t h5diff(const char *fname1, { h5difftrace("h5diff no object specified\n"); /* set root group */ - obj1fullname = (char*)HDcalloc(2, sizeof(char)); + obj1fullname = (char*)HDcalloc((size_t)2, sizeof(char)); HDstrcat(obj1fullname, "/"); obj1type = H5TRAV_TYPE_GROUP; - obj2fullname = (char*)HDcalloc(2, sizeof(char)); + obj2fullname = (char*)HDcalloc((size_t)2, sizeof(char)); HDstrcat(obj2fullname, "/"); obj2type = H5TRAV_TYPE_GROUP; } @@ -1554,9 +1554,9 @@ hsize_t diff(hid_t file1_id, hid_t grp1_id = (-1); hid_t grp2_id = (-1); int ret; - int is_dangle_link1 = 0; - int is_dangle_link2 = 0; - int is_hard_link = 0; + hbool_t is_dangle_link1 = FALSE; + hbool_t is_dangle_link2 = FALSE; + hbool_t is_hard_link = FALSE; hsize_t nfound = 0; h5trav_type_t object_type; @@ -1598,7 +1598,7 @@ hsize_t diff(hid_t file1_id, goto out; } else - is_dangle_link1 = 1; + is_dangle_link1 = TRUE; } else if (ret < 0) goto out; @@ -1616,7 +1616,7 @@ hsize_t diff(hid_t file1_id, goto out; } else - is_dangle_link2 = 1; + is_dangle_link2 = TRUE; } else if (ret < 0) goto out; diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 9e1c8bb..04b640f 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -71,7 +71,7 @@ typedef struct { double percent; /* relative error value */ int n; /* count, compare up to count */ hsize_t count; /* count value */ - int follow_links; /* follow symbolic links */ + hbool_t follow_links; /* follow symbolic links */ int no_dangle_links; /* return error when find dangling link */ int err_stat; /* an error ocurred (1, error, 0, no error) */ int cmn_objs; /* do we have common objects */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 7dba0e5..d08c23f 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -5792,14 +5792,14 @@ int ull2float(unsigned long long ull_value, float *f_value) src_size = H5Tget_size(H5T_NATIVE_ULLONG); dst_size = H5Tget_size(H5T_NATIVE_FLOAT); - buf = (unsigned char*)HDcalloc(1, MAX(src_size, dst_size)); + buf = (unsigned char*)HDcalloc((size_t)1, MAX(src_size, dst_size)); if(!buf) goto error; HDmemcpy(buf, &ull_value, src_size); /* do conversion */ - if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, 1, buf, NULL, dxpl_id)<0) + if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t)1, buf, NULL, dxpl_id)<0) goto error; HDmemcpy(f_value, buf, dst_size); @@ -6358,9 +6358,9 @@ static void get_member_types(hid_t tid, mcomp_t *members) return; members->n = (unsigned)nmembs; - members->ids = (hid_t *)HDcalloc(members->n, sizeof(hid_t)); - members->offsets = (size_t *)HDcalloc(members->n, sizeof(size_t)); - members->m = (mcomp_t **)HDcalloc(members->n, sizeof(mcomp_t *)); + members->ids = (hid_t *)HDcalloc((size_t)members->n, sizeof(hid_t)); + members->offsets = (size_t *)HDcalloc((size_t)members->n, sizeof(size_t)); + members->m = (mcomp_t **)HDcalloc((size_t)members->n, sizeof(mcomp_t *)); for(u = 0; u < members->n; u++) { diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index ef1d761..44b623f 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -169,7 +169,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if(H5Aget_name(attr1_id, ATTR_NAME_MAX, name1) < 0) + if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) goto error; /*------------------ @@ -177,7 +177,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if(H5Aget_name(attr2_id, ATTR_NAME_MAX, name2) < 0) + if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) goto error; /* criteria is string compare */ @@ -225,7 +225,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if(H5Aget_name(attr1_id, ATTR_NAME_MAX, name1) < 0) + if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) goto error; table_attr_mark_exist(infile, name1, table_lp); @@ -247,7 +247,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ - if(H5Aget_name(attr2_id, ATTR_NAME_MAX, name2) < 0) + if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) goto error; table_attr_mark_exist(infile, name2, table_lp); @@ -447,8 +447,8 @@ hsize_t diff_attr(hid_t loc1_id, for(j = 0; j < rank1; j++) nelmts1 *= dims1[j]; - buf1 = (void *)HDmalloc((unsigned)(nelmts1 * msize1)); - buf2 = (void *)HDmalloc((unsigned)(nelmts1 * msize2)); + buf1 = (void *)HDmalloc((size_t)(nelmts1 * msize1)); + buf2 = (void *)HDmalloc((size_t)(nelmts1 * msize2)); if(buf1 == NULL || buf2 == NULL) { parallel_print( "cannot read into memory\n" ); goto error; diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index 341a5c9..2da21ef 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -62,7 +62,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr /* check availability of filters */ for(i = 0; i < nfilters; i++) { - if((filtn = H5Pget_filter2(dcpl_id, (unsigned)i, 0, 0, 0, 0, 0, NULL)) < 0) + if((filtn = H5Pget_filter2(dcpl_id, (unsigned)i, 0, 0, 0, (size_t)0, 0, NULL)) < 0) return -1; switch(filtn) |