summaryrefslogtreecommitdiffstats
path: root/tools/h5diff
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-08-25 20:00:56 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-08-25 20:00:56 (GMT)
commit32220914a5313c0586dc59c89946d31334ad8b63 (patch)
tree8bc3eebbdb4591ea3439c20e626b7197e83c8a20 /tools/h5diff
parentf841a942427dd5d5fc139e30e07125de634e1863 (diff)
downloadhdf5-32220914a5313c0586dc59c89946d31334ad8b63.zip
hdf5-32220914a5313c0586dc59c89946d31334ad8b63.tar.gz
hdf5-32220914a5313c0586dc59c89946d31334ad8b63.tar.bz2
[svn-r7401] Purpose:
Code cleanup Description: Remove various "fixtype" routines which duplicate (and actually pre-date) the functionality in H5Tget_native_type in favor of having the tools call H5Tget_native_type(). This provides the same functionality (actually better functionality, since the old "fixtype" routines didn't handle alignment of compound fields correctly) and reduces the amount of code to maintain. Add additional tests to dump out a "complex" compound datatype which exercises more code in the library for aligning compound fields correctly. Platforms tested: FreeBSD 4.8 (sleipnir) h5committest
Diffstat (limited to 'tools/h5diff')
-rw-r--r--tools/h5diff/h5diff.c122
1 files changed, 4 insertions, 118 deletions
diff --git a/tools/h5diff/h5diff.c b/tools/h5diff/h5diff.c
index 35eb0d1..c80653e 100644
--- a/tools/h5diff/h5diff.c
+++ b/tools/h5diff/h5diff.c
@@ -79,7 +79,6 @@ static int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_
#ifdef NOT_YET
static void list( const char *filename, int nobjects, info_t *info );
#endif /* NOT_YET */
-static hid_t fixtype( hid_t f_type );
static int h5diff_can_diff( hid_t type_id );
static void print_datatype(hid_t type);
static int check_n_input( const char* );
@@ -1083,8 +1082,8 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
*-------------------------------------------------------------------------
*/
- m_type1 = fixtype( f_type1 );
- m_type2 = fixtype( f_type2 );
+ m_type1 = H5Tget_native_type( f_type1 , H5T_DIR_DEFAULT);
+ m_type2 = H5Tget_native_type( f_type2 , H5T_DIR_DEFAULT);
m_size1 = H5Tget_size( m_type1 );
m_size2 = H5Tget_size( m_type2 );
@@ -1136,13 +1135,13 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name,
if ( m_size1 < m_size2 )
{
assert( (H5Tclose(m_type1)) >=0);
- m_type1 = fixtype( f_type2 );
+ m_type1 = H5Tget_native_type( f_type2 , H5T_DIR_DEFAULT);
m_size1 = H5Tget_size( m_type1 );
}
else
{
assert( (H5Tclose(m_type2)) >=0);
- m_type2 = fixtype( f_type1 );
+ m_type2 = H5Tget_native_type( f_type1 , H5T_DIR_DEFAULT);
m_size2 = H5Tget_size( m_type2 );
}
#if defined (H5DIFF_DEBUG)
@@ -2294,119 +2293,6 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
-
-
-/*-------------------------------------------------------------------------
- * Function: fixtype
- *
- * Purpose: Given a file data type choose a memory data type which is
- * appropriate
- *
- * Return: Memory data type
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
- * Comments: Adapted from h5tools_fixtype
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static
-hid_t fixtype(hid_t f_type)
-{
- hid_t m_type = -1;
- size_t size;
-
- size = H5Tget_size(f_type);
-
- switch (H5Tget_class(f_type))
- {
- default:
- return -1;
- case H5T_INTEGER:
-/*
- * Use the smallest native integer type of the same sign as the file
- * such that the memory type is at least as large as the file type.
- * If there is no memory type large enough then use the largest
- * memory type available.
- */
- if (size <= sizeof(char))
- {
- m_type = H5Tcopy(H5T_NATIVE_SCHAR);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_SCHAR\n");
- #endif
- }
- else if (size <= sizeof(short))
- {
- m_type = H5Tcopy(H5T_NATIVE_SHORT);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_SHORT\n");
- #endif
- }
- else if (size <= sizeof(int))
- {
- m_type = H5Tcopy(H5T_NATIVE_INT);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_INT\n");
- #endif
- }
- else if (size <= sizeof(long))
- {
- m_type = H5Tcopy(H5T_NATIVE_LONG);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_LONG\n");
- #endif
- }
- else
- {
- m_type = H5Tcopy(H5T_NATIVE_LLONG);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_LLONG\n");
- #endif
- }
-
- H5Tset_sign(m_type, H5Tget_sign(f_type));
- break;
-
- case H5T_FLOAT:
-/*
- * Use the smallest native floating point type available such that
- * its size is at least as large as the file type. If there is not
- * native type large enough then use the largest native type.
- */
- if (size <= sizeof(float))
- {
- m_type = H5Tcopy(H5T_NATIVE_FLOAT);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_FLOAT\n");
- #endif
- }
- else if (size <= sizeof(double))
- {
- m_type = H5Tcopy(H5T_NATIVE_DOUBLE);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_DOUBLE\n");
- #endif
- }
- else
- {
- m_type = H5Tcopy(H5T_NATIVE_LDOUBLE);
- #if defined (H5DIFF_DEBUG)
- printf("using memory type H5T_NATIVE_LDOUBLE\n");
- #endif
- }
- break;
-
- }
-
- return m_type;
-}
-
-
/*-------------------------------------------------------------------------
* Function: h5diff_can_diff
*