diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2013-04-09 23:18:29 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2013-04-09 23:18:29 (GMT) |
commit | f56cc4156ec09d434b4f474afe5ed5b3786c5fe5 (patch) | |
tree | 04c71800e236564d469cd88256728825e3928baa /tools/lib | |
parent | 0b7490e7e4f2121b15fe01daa1cce318dab36ad9 (diff) | |
download | hdf5-f56cc4156ec09d434b4f474afe5ed5b3786c5fe5.zip hdf5-f56cc4156ec09d434b4f474afe5ed5b3786c5fe5.tar.gz hdf5-f56cc4156ec09d434b4f474afe5ed5b3786c5fe5.tar.bz2 |
[svn-r23568] Bring revision 22634:22690 from trunk to revise_chunks.
h5committested.
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff.h | 5 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 8 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 24 | ||||
-rw-r--r-- | tools/lib/h5diff_util.c | 42 |
4 files changed, 59 insertions, 20 deletions
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index f05d0de..2530805 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -180,6 +180,7 @@ hsize_t diff_attr(hid_t loc1_id, *------------------------------------------------------------------------- */ +/* in h5diff_util.c */ void print_found(hsize_t nfound); void print_type(hid_t type); const char* diff_basename(const char *name); @@ -187,6 +188,10 @@ const char* get_type(h5trav_type_t type); const char* get_class(H5T_class_t tclass); const char* get_sign(H5T_sign_t sign); void print_dimensions (int rank, hsize_t *dims); +herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id, + hid_t *m_tid1, hid_t *m_tid2, + size_t *m_size1, size_t *m_size2); +/* in h5diff.c */ int print_objname(diff_opt_t *options, hsize_t nfound); void do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts); void do_print_attrname (const char *attr, const char *path1, const char *path2); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 85cd01f..144159a 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -405,6 +405,14 @@ hsize_t diff_attr(hid_t loc1_id, continue; } + /*----------------------------------------------------------------- + * "upgrade" the smaller memory size + *------------------------------------------------------------------ + */ + if (FAIL == match_up_memsize (ftype1_id, ftype2_id, + &mtype1_id, &mtype2_id, + &msize1, &msize2)) + goto error; /*--------------------------------------------------------------------- * read diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index da58cde..f9c7d1c 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -368,26 +368,10 @@ hsize_t diff_datasetid( hid_t did1, */ h5difftrace("upgrade the smaller memory size?\n"); - if(m_size1 != m_size2) { - h5difftrace("m_size1 != m_size2\n"); - if(m_size1 < m_size2) { - H5Tclose(m_tid1); - - if((m_tid1 = h5tools_get_native_type(f_tid2)) < 0) - goto error; - - m_size1 = H5Tget_size(m_tid1); - } /* end if */ - else { - H5Tclose(m_tid2); - - if((m_tid2 = h5tools_get_native_type(f_tid1)) < 0) - goto error; - - m_size2 = H5Tget_size(m_tid2); - } /* end else */ - } /* end if */ - HDassert(m_size1 == m_size2); + if (FAIL == match_up_memsize (f_tid1, f_tid2, + &m_tid1, &m_tid2, + &m_size1, &m_size2)) + goto error; /* print names */ if(obj1_name) diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 0d476b6..aefd641 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -311,4 +311,46 @@ void print_found(hsize_t nfound) } +/*----------------------------------------------------------------- + * Function: match_up_memsize + * + * Purpose: match smaller memory size up to bigger memory size + *------------------------------------------------------------------ + */ +herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id, + hid_t *m_tid1, hid_t *m_tid2, + size_t *m_size1, size_t *m_size2) +{ + herr_t ret = SUCCEED; + + if( (*m_size1) != (*m_size2) ) + { + if( (*m_size1) < (*m_size2) ) + { + H5Tclose( *m_tid1 ); + + if(( (*m_tid1) = h5tools_get_native_type(f_tid2_id)) < 0) + { + ret = FAIL; + goto out; + } + + *m_size1 = H5Tget_size( *m_tid1 ); + } /* end if */ + else { + H5Tclose(*m_tid2); + if(( (*m_tid2) = h5tools_get_native_type(f_tid1_id)) < 0) + { + ret = FAIL; + goto out; + } + + *m_size2 = H5Tget_size(*m_tid2); + } /* end else */ + } /* end if */ + HDassert( (*m_size1) == (*m_size2) ); + +out: + return ret; +} |