diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-01-28 02:11:39 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-01-28 02:11:39 (GMT) |
commit | 7191f26717255667e86c86559ffc316f73f4c1bd (patch) | |
tree | 3179c22066f9880e7f09849e8a620ad398f68fa9 | |
parent | 2cbd7f1b3cd50d21279ef81093632cb7bf6f97ea (diff) | |
download | hdf5-7191f26717255667e86c86559ffc316f73f4c1bd.zip hdf5-7191f26717255667e86c86559ffc316f73f4c1bd.tar.gz hdf5-7191f26717255667e86c86559ffc316f73f4c1bd.tar.bz2 |
[svn-r16369] Description:
Bring r16347:16367 from trunk into revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty)
(h5committest not required on this branch)
55 files changed, 671 insertions, 224 deletions
@@ -1472,6 +1472,12 @@ ./tools/h5diff/testfiles/h5diff_100.txt ./tools/h5diff/testfiles/h5diff_101.txt ./tools/h5diff/testfiles/h5diff_102.txt +./tools/h5diff/testfiles/h5diff_200.txt +./tools/h5diff/testfiles/h5diff_201.txt +./tools/h5diff/testfiles/h5diff_202.txt +./tools/h5diff/testfiles/h5diff_203.txt +./tools/h5diff/testfiles/h5diff_204.txt +./tools/h5diff/testfiles/h5diff_205.txt ./tools/h5diff/testfiles/h5diff_basic1.h5 diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index befb1cd..ef38b31 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -1537,23 +1537,27 @@ nh5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters) * Programmer: Xiangyang Su * Friday, February 25, 2000 * Modifications: + * Since cd_nelmts has IN/OUT attributes, fixed the input and + * returned value of cd_nelmnts to satisfy this specification. + * MSB January 27, 2009 *---------------------------------------------------------------------------*/ int_f nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name, int_f* filter_id) { unsigned int c_flags; size_t c_cd_nelmts; - size_t c_cd_nelmts_in = (size_t)*cd_nelmts; H5Z_filter_t c_filter; unsigned int *c_cd_values = NULL; char *c_name = NULL; unsigned i; int ret_value = -1; + c_cd_nelmts = (size_t)*cd_nelmts; + if(NULL == (c_name = (char *)malloc((size_t)*namelen + 1))) goto DONE; - if(NULL == (c_cd_values = (unsigned int *)malloc(sizeof(unsigned int) * c_cd_nelmts_in))) + if(NULL == (c_cd_values = (unsigned int *)malloc(sizeof(unsigned int) * c_cd_nelmts))) goto DONE; /* @@ -1567,7 +1571,7 @@ nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* *flags = (int_f)c_flags; HD5packFstring(c_name, _fcdtocp(name), strlen(c_name)); - for(i = 0; i < c_cd_nelmts_in; i++) + for(i = 0; i < c_cd_nelmts; i++) cd_values[i] = (int_f)c_cd_values[i]; ret_value = 0; @@ -1694,13 +1698,17 @@ nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, */ c_prp_id = (hid_t)*prp_id; c_idx = (unsigned)*idx; - status = H5Pget_external(c_prp_id, c_idx, c_namelen, c_name, &c_offset, &size ); + status = H5Pget_external(c_prp_id, c_idx, c_namelen+1, c_name, &c_offset, &size ); if (status < 0) goto DONE; *offset = (int_f)c_offset; *bytes = (hsize_t_f)size; - HD5packFstring(c_name, _fcdtocp(name), strlen(c_name)); + /* Note: if the size of the fortran buffer is larger then the returned string + * from the function then we need to give HD5packFstring the fortran buffer size so + * that it fills the remaining unused characters with blanks. MSB + */ + HD5packFstring(c_name, _fcdtocp(name), c_namelen+1); ret_value = 0; DONE: diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 230cb8c..4e35418 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -141,6 +141,8 @@ Bug Fixes since HDF5-1.8.0 release Library ------- + - Changed H5Tset_order to properly reject H5T_ORDER_NONE for most + datatypes. (NAF - 2009/01/27) - Fixed a bug where H5Tpack wouldn't remove trailing space from an otherwise packed compound type. (NAF - 2009/01/14) - Fixed up some old v2 btree assertions that get run in debug mode that diff --git a/src/H5B2int.c b/src/H5B2int.c index aa1fdca..b5d4048 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -275,7 +275,7 @@ H5B2_shared_free(void *_shared) /* Free the array of offsets into the native key block */ if(shared->nat_off) - H5FL_SEQ_FREE(size_t, shared->nat_off); + shared->nat_off = H5FL_SEQ_FREE(size_t, shared->nat_off); /* Release the node info */ if(shared->node_info) { @@ -292,11 +292,11 @@ H5B2_shared_free(void *_shared) } /* end for */ /* Free the array of node info structs */ - H5FL_SEQ_FREE(H5B2_node_info_t, shared->node_info); + shared->node_info = H5FL_SEQ_FREE(H5B2_node_info_t, shared->node_info); } /* end if */ /* Free the shared B-tree info itself */ - (void)H5FL_FREE(H5B2_shared_t, shared); + shared = H5FL_FREE(H5B2_shared_t, shared); done: FUNC_LEAVE_NOAPI(ret_value) @@ -906,7 +906,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); } /* end if */ /* Release the extensible array wrapper */ - (void)H5FL_FREE(H5EA_t, ea); + ea = H5FL_FREE(H5EA_t, ea); CATCH diff --git a/src/H5EAcache.c b/src/H5EAcache.c index a3c9f87..bf2bf43 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -596,7 +596,7 @@ H5EA__cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, /* Decode elements in index block */ if(hdr->cparam.idx_blk_elmts > 0) { /* Convert from raw elements on disk into native elements in memory */ - if((hdr->cparam.cls->decode)(p, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts) < 0) + if((hdr->cparam.cls->decode)(p, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts, hdr->cb_ctx) < 0) H5E_THROW(H5E_CANTDECODE, "can't decode extensible array index elements") p += (hdr->cparam.idx_blk_elmts * hdr->cparam.raw_elmt_size); } /* end if */ @@ -720,7 +720,7 @@ H5EA__cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* Encode elements in index block */ if(iblock->hdr->cparam.idx_blk_elmts > 0) { /* Convert from native elements in memory into raw elements on disk */ - if((iblock->hdr->cparam.cls->encode)(p, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts) < 0) + if((iblock->hdr->cparam.cls->encode)(p, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts, iblock->hdr->cb_ctx) < 0) H5E_THROW(H5E_CANTENCODE, "can't encode extensible array index elements") p += (iblock->hdr->cparam.idx_blk_elmts * iblock->hdr->cparam.raw_elmt_size); } /* end if */ @@ -1326,7 +1326,7 @@ H5EA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, if(!dblock->npages) { /* Decode elements in data block */ /* Convert from raw elements on disk into native elements in memory */ - if((hdr->cparam.cls->decode)(p, dblock->elmts, *nelmts) < 0) + if((hdr->cparam.cls->decode)(p, dblock->elmts, *nelmts, hdr->cb_ctx) < 0) H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements") p += (*nelmts * hdr->cparam.raw_elmt_size); } /* end if */ @@ -1440,7 +1440,7 @@ H5EA__cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* Encode elements in data block */ /* Convert from native elements in memory into raw elements on disk */ - if((dblock->hdr->cparam.cls->encode)(p, dblock->elmts, dblock->nelmts) < 0) + if((dblock->hdr->cparam.cls->encode)(p, dblock->elmts, dblock->nelmts, dblock->hdr->cb_ctx) < 0) H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements") p += (dblock->nelmts * dblock->hdr->cparam.raw_elmt_size); } /* end if */ @@ -1655,7 +1655,7 @@ HDfprintf(stderr, "%s: addr = %a\n", FUNC, addr); /* Decode elements in data block page */ /* Convert from raw elements on disk into native elements in memory */ - if((hdr->cparam.cls->decode)(p, dblk_page->elmts, hdr->dblk_page_nelmts) < 0) + if((hdr->cparam.cls->decode)(p, dblk_page->elmts, hdr->dblk_page_nelmts, hdr->cb_ctx) < 0) H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements") p += (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size); @@ -1750,7 +1750,7 @@ H5EA__cache_dblk_page_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t ad /* Encode elements in data block page */ /* Convert from native elements in memory into raw elements on disk */ - if((dblk_page->hdr->cparam.cls->encode)(p, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts) < 0) + if((dblk_page->hdr->cparam.cls->encode)(p, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts, dblk_page->hdr->cb_ctx) < 0) H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements") p += (dblk_page->hdr->dblk_page_nelmts * dblk_page->hdr->cparam.raw_elmt_size); diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index afbd6bd..349dceb 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -140,6 +140,10 @@ H5EA__hdr_alloc(H5F_t *f, const H5EA_class_t *cls)) /* Set the class of the array */ hdr->cparam.cls = cls; + /* Create the callback context */ + if(NULL == (hdr->cb_ctx = (*cls->crt_context)(f))) + H5E_THROW(H5E_CANTCREATE, "unable to create extensible array client callback context") + /* Set the return value */ ret_value = hdr; @@ -686,6 +690,11 @@ H5EA__hdr_dest(H5EA_hdr_t *hdr)) HDassert(hdr); HDassert(hdr->rc == 0); + /* Destroy the callback context */ + if((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0) + H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array client callback context") + hdr->cb_ctx = NULL; + /* Check for data block element buffer factory info to free */ if(hdr->elmt_fac.fac) { unsigned u; /* Local index variable */ @@ -712,7 +721,7 @@ H5EA__hdr_dest(H5EA_hdr_t *hdr)) hdr->sblk_info = (H5EA_sblk_info_t *)H5FL_SEQ_FREE(H5EA_sblk_info_t, hdr->sblk_info); /* Free the shared info itself */ - (void)H5FL_FREE(H5EA_hdr_t, hdr); + hdr = H5FL_FREE(H5EA_hdr_t, hdr); CATCH diff --git a/src/H5EApkg.h b/src/H5EApkg.h index 51305c4..7ac5be6 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -464,7 +464,7 @@ typedef struct H5EA_hdr_t { /* Information for H5AC cache functions, _must_ be first field in structure */ H5AC_info_t cache_info; - /* Extensible array configuration/creation parameters (stored) */ + /* Extensible array configuration/creation parameters (stored in header) */ H5EA_create_t cparam; /* Creation parameters for extensible array */ /* Index block information (stored in header) */ @@ -496,6 +496,9 @@ typedef struct H5EA_hdr_t { /* Data block information (not stored) */ size_t dblk_page_nelmts; /* # of elements per data block page */ + + /* Client information (not stored) */ + void *cb_ctx; /* Callback context */ } H5EA_hdr_t; /* The extensible array index block information */ diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index a1f3221..3b9ba4d 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -62,9 +62,11 @@ typedef struct H5EA_class_t { size_t nat_elmt_size; /* Size of native (memory) element */ /* Extensible array client callback methods */ + void *(*crt_context)(const H5F_t *f); /* Create context for other callbacks */ + herr_t (*dst_context)(void *ctx); /* Destroy context */ herr_t (*fill)(void *nat_blk, size_t nelmts); /* Fill array of elements with encoded form of "missing element" value */ - herr_t (*encode)(void *raw, const void *elmt, size_t nelmts); /* Encode elements from native form to disk storage form */ - herr_t (*decode)(const void *raw, void *elmt, size_t nelmts); /* Decode elements from disk storage form to native form */ + herr_t (*encode)(void *raw, const void *elmt, size_t nelmts, void *ctx); /* Encode elements from native form to disk storage form */ + herr_t (*decode)(const void *raw, void *elmt, size_t nelmts, void *ctx); /* Decode elements from disk storage form to native form */ herr_t (*debug)(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt); /* Print an element for debugging */ } H5EA_class_t; diff --git a/src/H5EAtest.c b/src/H5EAtest.c index eea69ea..31dfb5f 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -39,6 +39,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5EApkg.h" /* Extensible Arrays */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Vprivate.h" /* Vector functions */ @@ -46,11 +47,17 @@ /* Local Macros */ /****************/ +/* Sanity checking value for callback contexts */ +#define H5EA__TEST_BOGUS_VAL 42 /******************/ /* Local Typedefs */ /******************/ +/* Callback context */ +typedef struct H5EA__test_ctx_t { + uint32_t bogus; /* Placeholder field to verify that context is working */ +} H5EA__test_ctx_t; /********************/ /* Package Typedefs */ @@ -62,9 +69,13 @@ /********************/ /* Extensible array class callbacks */ +static void *H5EA__test_crt_context(const H5F_t *f); +static herr_t H5EA__test_dst_context(void *ctx); static herr_t H5EA__test_fill(void *nat_blk, size_t nelmts); -static herr_t H5EA__test_encode(void *raw, const void *elmt, size_t nelmts); -static herr_t H5EA__test_decode(const void *raw, void *elmt, size_t nelmts); +static herr_t H5EA__test_encode(void *raw, const void *elmt, size_t nelmts, + void *ctx); +static herr_t H5EA__test_decode(const void *raw, void *elmt, size_t nelmts, + void *ctx); static herr_t H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt); @@ -77,6 +88,8 @@ static herr_t H5EA__test_debug(FILE *stream, int indent, int fwidth, const H5EA_class_t H5EA_CLS_TEST[1]={{ H5EA_CLS_TEST_ID, /* Type of Extensible array */ sizeof(uint64_t), /* Size of native element */ + H5EA__test_crt_context, /* Create context */ + H5EA__test_dst_context, /* Destroy context */ H5EA__test_fill, /* Fill block of missing elements callback */ H5EA__test_encode, /* Element encoding callback */ H5EA__test_decode, /* Element decoding callback */ @@ -93,6 +106,76 @@ const H5EA_class_t H5EA_CLS_TEST[1]={{ /* Local Variables */ /*******************/ +/* Declare a free list to manage the H5EA__test_ctx_t struct */ +H5FL_DEFINE_STATIC(H5EA__test_ctx_t); + + + +/*------------------------------------------------------------------------- + * Function: H5EA__test_crt_context + * + * Purpose: Create context for callbacks + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Quincey Koziol + * Tuesday, January 27, 2009 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(STATIC, ERR, +void *, NULL, NULL, +H5EA__test_crt_context(const H5F_t UNUSED *f)) + + /* Local variables */ + H5EA__test_ctx_t *ctx; /* Context for callbacks */ + + /* Sanity checks */ + HDassert(f); + + /* Allocate new context structure */ + if(NULL == (ctx = H5FL_MALLOC(H5EA__test_ctx_t))) + H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context") + + /* Initialize the context */ + ctx->bogus = H5EA__TEST_BOGUS_VAL; + + /* Set return value */ + ret_value = ctx; + +CATCH + +END_FUNC(STATIC) /* end H5EA__test_crt_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA__test_dst_context + * + * Purpose: Destroy context for callbacks + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Tuesday, January 27, 2009 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(STATIC, NOERR, +herr_t, SUCCEED, -, +H5EA__test_dst_context(void *_ctx)) + + /* Local variables */ + H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ + + /* Sanity checks */ + HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); + + /* Release context structure */ + ctx = H5FL_FREE(H5EA__test_ctx_t, ctx); + +END_FUNC(STATIC) /* end H5EA__test_dst_context() */ /*------------------------------------------------------------------------- @@ -139,15 +222,17 @@ END_FUNC(STATIC) /* end H5EA__test_fill() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, -H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts)) +H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)) /* Local variables */ + H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */ /* Sanity checks */ HDassert(raw); HDassert(elmt); HDassert(nelmts); + HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); /* Encode native elements into raw elements */ while(nelmts) { @@ -180,9 +265,10 @@ END_FUNC(STATIC) /* end H5EA__test_encode() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, -H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts)) +H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)) /* Local variables */ + H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ uint64_t *elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */ const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ @@ -190,6 +276,7 @@ H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts)) HDassert(raw); HDassert(elmt); HDassert(nelmts); + HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); /* Decode raw elements into native elements */ while(nelmts) { @@ -2326,7 +2326,7 @@ H5F_decr_nopen_objs(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_addr_encode + * Function: H5F_addr_encode_len * * Purpose: Encodes an address into the buffer pointed to by *PP and * then increments the pointer to the first byte after the @@ -2337,35 +2337,65 @@ H5F_decr_nopen_objs(H5F_t *f) * Programmer: Robb Matzke * Friday, November 7, 1997 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ void -H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) +H5F_addr_encode_len(size_t addr_len, uint8_t **pp/*in,out*/, haddr_t addr) { - unsigned i; + unsigned u; /* Local index variable */ + + /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_addr_encode_len) - assert(f); - assert(pp && *pp); + HDassert(addr_len); + HDassert(pp && *pp); - if (H5F_addr_defined(addr)) { - for (i=0; i<H5F_SIZEOF_ADDR(f); i++) { + if(H5F_addr_defined(addr)) { + for(u = 0; u < addr_len; u++) { *(*pp)++ = (uint8_t)(addr & 0xff); addr >>= 8; - } - assert("overflow" && 0 == addr); - - } else { - for (i=0; i<H5F_SIZEOF_ADDR(f); i++) + } /* end for */ + HDassert("overflow" && 0 == addr); + } /* end if */ + else { + for(u = 0; u < addr_len; u++) *(*pp)++ = 0xff; - } -} + } /* end else */ + + FUNC_LEAVE_NOAPI_VOID +} /* end H5F_addr_encode_len() */ /*------------------------------------------------------------------------- - * Function: H5F_addr_decode + * Function: H5F_addr_encode + * + * Purpose: Encodes an address into the buffer pointed to by *PP and + * then increments the pointer to the first byte after the + * address. An undefined value is stored as all 1's. + * + * Return: void + * + * Programmer: Robb Matzke + * Friday, November 7, 1997 + * + *------------------------------------------------------------------------- + */ +void +H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_addr_encode) + + HDassert(f); + + H5F_addr_encode_len(H5F_SIZEOF_ADDR(f), pp, addr); + + FUNC_LEAVE_NOAPI_VOID +} /* end H5F_addr_encode() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_addr_decode_len * * Purpose: Decodes an address from the buffer pointed to by *PP and * updates the pointer to point to the next byte after the @@ -2379,40 +2409,88 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) * Programmer: Robb Matzke * Friday, November 7, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ void -H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*out*/) +H5F_addr_decode_len(size_t addr_len, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*out*/) { - unsigned i; - haddr_t tmp; - uint8_t c; - hbool_t all_zero = TRUE; + hbool_t all_zero = TRUE; /* True if address was all zeroes */ + unsigned u; /* Local index variable */ - assert(f); - assert(pp && *pp); - assert(addr_p); + /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_addr_decode_len) + HDassert(addr_len); + HDassert(pp && *pp); + HDassert(addr_p); + + /* Reset value in destination */ *addr_p = 0; - for (i=0; i<H5F_SIZEOF_ADDR(f); i++) { + /* Decode bytes from address */ + for(u = 0; u < addr_len; u++) { + uint8_t c; /* Local decoded byte */ + + /* Get decoded byte (and advance pointer) */ c = *(*pp)++; - if (c != 0xff) + + /* Check for non-undefined address byte value */ + if(c != 0xff) all_zero = FALSE; - if (i<sizeof(*addr_p)) { - tmp = c; - tmp <<= (i * 8); /*use tmp to get casting right */ + if(u < sizeof(*addr_p)) { + haddr_t tmp = c; /* Local copy of address, for casting */ + + /* Shift decoded byte to correct position */ + tmp <<= (u * 8); /*use tmp to get casting right */ + + /* Merge into already decoded bytes */ *addr_p |= tmp; - } else if (!all_zero) { - assert(0 == **pp); /*overflow */ - } - } - if (all_zero) + } /* end if */ + else + if(!all_zero) + HDassert(0 == **pp); /*overflow */ + } /* end for */ + + /* If 'all_zero' is still TRUE, the address was entirely composed of '0xff' + * bytes, which is the encoded form of 'HADDR_UNDEF', so set the destination + * to that value */ + if(all_zero) *addr_p = HADDR_UNDEF; -} + + FUNC_LEAVE_NOAPI_VOID +} /* end H5F_addr_decode_len() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_addr_decode + * + * Purpose: Decodes an address from the buffer pointed to by *PP and + * updates the pointer to point to the next byte after the + * address. + * + * If the value read is all 1's then the address is returned + * with an undefined value. + * + * Return: void + * + * Programmer: Robb Matzke + * Friday, November 7, 1997 + * + *------------------------------------------------------------------------- + */ +void +H5F_addr_decode(const H5F_t *f, const uint8_t **pp/*in,out*/, haddr_t *addr_p/*out*/) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_addr_decode) + + HDassert(f); + + H5F_addr_decode_len(H5F_SIZEOF_ADDR(f), pp, addr_p); + + FUNC_LEAVE_NOAPI_VOID +} /* end H5F_addr_decode() */ /*------------------------------------------------------------------------- diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index e717b99..cd6bcd0 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -508,8 +508,11 @@ H5_DLL herr_t H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr, /* Address-related functions */ H5_DLL void H5F_addr_encode(const H5F_t *, uint8_t** /*in,out*/, haddr_t); +H5_DLL void H5F_addr_encode_len(size_t addr_len, uint8_t** /*in,out*/, haddr_t); H5_DLL void H5F_addr_decode(const H5F_t *, const uint8_t** /*in,out*/, - haddr_t* /*out*/); + haddr_t* /*out*/); +H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t** /*in,out*/, + haddr_t* /*out*/); /* File access property list callbacks */ H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data); diff --git a/src/H5Torder.c b/src/H5Torder.c index 34dbd8e..6c0667b 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -158,6 +158,8 @@ H5Tset_order(hid_t type_id, H5T_order_t order) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ + if (order == H5T_ORDER_NONE && !(H5T_REFERENCE == dt->shared->type || H5T_IS_FIXED_STRING(dt->shared))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal byte order") if (!H5T_IS_ATOMIC(dt->shared)) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype") diff --git a/test/dtypes.c b/test/dtypes.c index 3aad1a7..991b2c9 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -5644,6 +5644,172 @@ error: /*------------------------------------------------------------------------- + * Function: test_set_order + * + * Purpose: Tests H5Tset_order/H5Tget_order. Verifies that + * H5T_ORDER_NONE cannot be set. + * + * Return: Success: 0 + * + * Failure: number of errors + * + * Programmer: Neil Fortner + * January 23, 2009 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +test_set_order(void) +{ + hid_t dtype; /* Datatype ID */ + H5T_order_t order; /* Byte order */ + hsize_t dims[2] = {3, 4}; /* Array dimenstions */ + herr_t ret; /* Generic return value */ + + TESTING("H5Tset/get_order"); + + /* Integer */ + if ((dtype = H5Tcopy(H5T_STD_I32BE)) < 0) TEST_ERROR + if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR; + H5E_BEGIN_TRY + ret = H5Tset_order(dtype, H5T_ORDER_NONE); + H5E_END_TRY + if (ret >= 0) TEST_ERROR + if (H5Tset_order(dtype, H5T_ORDER_LE) < 0) TEST_ERROR + if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tclose(dtype) < 0) TEST_ERROR + + /* Float */ + if ((dtype = H5Tcopy(H5T_IEEE_F64LE)) < 0) TEST_ERROR + if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR; + H5E_BEGIN_TRY + ret = H5Tset_order(dtype, H5T_ORDER_NONE); + H5E_END_TRY + if (ret >= 0) TEST_ERROR + if (H5Tset_order(dtype, H5T_ORDER_BE) < 0) TEST_ERROR + if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tclose(dtype) < 0) TEST_ERROR + + /* Time */ + if ((dtype = H5Tcopy(H5T_UNIX_D64BE)) < 0) TEST_ERROR + if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR; + H5E_BEGIN_TRY + ret = H5Tset_order(dtype, H5T_ORDER_NONE); + H5E_END_TRY + if (ret >= 0) TEST_ERROR + if (H5Tset_order(dtype, H5T_ORDER_LE) < 0) TEST_ERROR + if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tclose(dtype) < 0) TEST_ERROR + + /* Fixed length string */ + if ((dtype = H5Tcopy(H5T_C_S1)) < 0) TEST_ERROR + if (H5Tset_size(dtype, 5) < 0) TEST_ERROR + if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0) TEST_ERROR; + if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR; + + /* Variable length string */ + if (H5Tset_size(dtype, H5T_VARIABLE) < 0) TEST_ERROR + H5E_BEGIN_TRY + ret = H5Tset_order(dtype, H5T_ORDER_NONE); + H5E_END_TRY + if (ret >= 0) TEST_ERROR + if (H5Tset_order(dtype, H5T_ORDER_BE) < 0) TEST_ERROR + if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tclose(dtype) < 0) TEST_ERROR + + /* Bitfield */ + if ((dtype = H5Tcopy(H5T_STD_B16LE)) < 0) TEST_ERROR + if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR; + H5E_BEGIN_TRY + ret = H5Tset_order(dtype, H5T_ORDER_NONE); + H5E_END_TRY + if (ret >= 0) TEST_ERROR + if (H5Tset_order(dtype, H5T_ORDER_BE) < 0) TEST_ERROR + if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tclose(dtype) < 0) TEST_ERROR + + /* Opaque - functions should fail */ + if ((dtype = H5Tcreate(H5T_OPAQUE, 96)) < 0) TEST_ERROR + H5E_BEGIN_TRY + ret = H5Tset_order(dtype, H5T_ORDER_LE); + order = H5Tget_order(dtype); + H5E_END_TRY + if (ret >= 0) TEST_ERROR + if (order >= 0) TEST_ERROR + if (H5Tclose(dtype) < 0) TEST_ERROR + + /* Compound - functions should fail */ + if ((dtype = H5Tcreate(H5T_COMPOUND, 48)) < 0) TEST_ERROR + H5E_BEGIN_TRY + ret = H5Tset_order(dtype, H5T_ORDER_LE); + order = H5Tget_order(dtype); + H5E_END_TRY + if (ret >= 0) TEST_ERROR + if (order >= 0) TEST_ERROR + if (H5Tclose(dtype) < 0) TEST_ERROR + + /* Object reference */ + if ((dtype = H5Tcopy(H5T_STD_REF_OBJ)) < 0) TEST_ERROR + if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0) TEST_ERROR; + if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tclose(dtype) < 0) TEST_ERROR + + /* Region reference */ + if ((dtype = H5Tcopy(H5T_STD_REF_DSETREG)) < 0) TEST_ERROR + if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tset_order(dtype, H5T_ORDER_NONE) < 0) TEST_ERROR; + if (H5T_ORDER_NONE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tclose(dtype) < 0) TEST_ERROR + + /* Enum */ + if ((dtype = H5Tenum_create(H5T_STD_I16BE)) < 0) TEST_ERROR + if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR; + H5E_BEGIN_TRY + ret = H5Tset_order(dtype, H5T_ORDER_NONE); + H5E_END_TRY + if (ret >= 0) TEST_ERROR + if (H5Tset_order(dtype, H5T_ORDER_LE) < 0) TEST_ERROR + if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tclose(dtype) < 0) TEST_ERROR + + /* Vlen */ + if ((dtype = H5Tvlen_create(H5T_STD_U64LE)) < 0) TEST_ERROR + if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR; + H5E_BEGIN_TRY + ret = H5Tset_order(dtype, H5T_ORDER_NONE); + H5E_END_TRY + if (ret >= 0) TEST_ERROR + if (H5Tset_order(dtype, H5T_ORDER_BE) < 0) TEST_ERROR + if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tclose(dtype) < 0) TEST_ERROR + + /* Array */ + if ((dtype = H5Tarray_create2(H5T_IEEE_F64BE, 2, dims)) < 0) TEST_ERROR + if (H5T_ORDER_BE != H5Tget_order(dtype)) TEST_ERROR; + H5E_BEGIN_TRY + ret = H5Tset_order(dtype, H5T_ORDER_NONE); + H5E_END_TRY + if (ret >= 0) TEST_ERROR + if (H5Tset_order(dtype, H5T_ORDER_LE) < 0) TEST_ERROR + if (H5T_ORDER_LE != H5Tget_order(dtype)) TEST_ERROR; + if (H5Tclose(dtype) < 0) TEST_ERROR + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY + H5Tclose (dtype); + H5E_END_TRY; + return 1; +} /* end test_set_order() */ + + +/*------------------------------------------------------------------------- * Function: test_deprec * * Purpose: Tests deprecated API routines for datatypes. @@ -5846,6 +6012,7 @@ main(void) nerrors += test_conv_bitfield(); nerrors += test_bitfield_funcs(); nerrors += test_opaque(); + nerrors += test_set_order(); if(nerrors) { printf("***** %lu FAILURE%s! *****\n", diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 8a49fa0..3f2b8cf 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -31,7 +31,7 @@ const char *progname = "h5diff"; * Command-line options: The user can specify short or long-named * parameters. */ -static const char *s_opts = "hVrvqn:d:p:N"; +static const char *s_opts = "hVrvqn:d:p:Nc"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", no_arg, 'V' }, @@ -42,6 +42,7 @@ static struct long_options l_opts[] = { { "delta", require_arg, 'd' }, { "relative", require_arg, 'p' }, { "nan", no_arg, 'N' }, + { "compare", no_arg, 'c' }, { NULL, 0, '\0' } }; @@ -138,6 +139,9 @@ void parse_command_line(int argc, case 'N': options->do_nans = 0; break; + case 'c': + options->m_list_not_cmp = 1; + break; } } @@ -194,11 +198,15 @@ void parse_command_line(int argc, if (options->not_cmp==1) { - printf("--------------------------------\n"); - printf("Some objects are not comparable\n"); - printf("--------------------------------\n"); - if (!options->m_verbose) - printf("Use -v for a list of objects.\n"); + if ( options->m_list_not_cmp == 0 ) + { + printf("--------------------------------\n"); + printf("Some objects are not comparable\n"); + printf("--------------------------------\n"); + printf("Use -c for a list of objects.\n"); + } + + } } @@ -331,6 +339,7 @@ void usage(void) printf(" -r, --report Report mode. Print differences\n"); printf(" -v, --verbose Verbose mode. Print differences, list of objects\n"); printf(" -q, --quiet Quiet mode. Do not do output\n"); + printf(" -c, --compare List objects that are not comparable\n"); printf(" -N, --nan Avoid NaNs detection\n"); printf(" -n C, --count=C Print differences up to C number\n"); diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index ca14501..ec379be 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -328,6 +328,25 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18); } + + /* not comparable objects */ + { + double data2[6] = {0,0,0,0,0,0}; + int data3[6] = {0,0,0,0,0,0}; + int data4[3][2] = {{0,0},{0,0},{0,0}}; + hsize_t dims3[2] = { 2,2 }; + int data5[2][2] = {{0,0},{0,0}}; + unsigned int data6[3][2] = {{0,0},{0,0},{0,0}}; + + write_dset(gid3,1,dims1,"dset1",H5T_NATIVE_DOUBLE,NULL); + write_dset(gid3,1,dims1,"dset2",H5T_NATIVE_DOUBLE,data2); + write_dset(gid3,1,dims1,"dset3",H5T_NATIVE_INT,data3); + write_dset(gid3,2,dims2,"dset4",H5T_NATIVE_INT,data4); + write_dset(gid3,2,dims3,"dset5",H5T_NATIVE_INT,data5); + write_dset(gid3,2,dims2,"dset6",H5T_NATIVE_UINT,data6); + + + } /*------------------------------------------------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_10.txt b/tools/h5diff/testfiles/h5diff_10.txt index 5480df1..316f06c 100644 --- a/tools/h5diff/testfiles/h5diff_10.txt +++ b/tools/h5diff/testfiles/h5diff_10.txt @@ -9,6 +9,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_16_1.txt b/tools/h5diff/testfiles/h5diff_16_1.txt index 6155ebf..519f695 100644 --- a/tools/h5diff/testfiles/h5diff_16_1.txt +++ b/tools/h5diff/testfiles/h5diff_16_1.txt @@ -8,6 +8,3 @@ position dset5 dset6 difference relative [ 1 1 ] 0 100 100 not comparable [ 2 1 ] 100 50 50 0.500000 5 differences found --------------------------------- -Some objects are not comparable --------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_16_2.txt b/tools/h5diff/testfiles/h5diff_16_2.txt index 43127bb..233b133 100644 --- a/tools/h5diff/testfiles/h5diff_16_2.txt +++ b/tools/h5diff/testfiles/h5diff_16_2.txt @@ -8,6 +8,3 @@ position dset7 dset8 difference relative [ 1 1 ] 0 100 100 not comparable [ 2 1 ] 100 50 50 0.500000 5 differences found --------------------------------- -Some objects are not comparable --------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_16_3.txt b/tools/h5diff/testfiles/h5diff_16_3.txt index 6da24cf..b96c8a4 100644 --- a/tools/h5diff/testfiles/h5diff_16_3.txt +++ b/tools/h5diff/testfiles/h5diff_16_3.txt @@ -8,6 +8,3 @@ position dset9 dset10 difference relative [ 1 1 ] 0 100 100 not comparable [ 2 1 ] 100 50 50 0.5 5 differences found --------------------------------- -Some objects are not comparable --------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_17.txt b/tools/h5diff/testfiles/h5diff_17.txt index 40ea563..2ffbda9 100644 --- a/tools/h5diff/testfiles/h5diff_17.txt +++ b/tools/h5diff/testfiles/h5diff_17.txt @@ -23,6 +23,12 @@ file1 file2 x /g1/fp2 x /g1/ld x /g2 + x /g2/dset1 + x /g2/dset2 + x /g2/dset3 + x /g2/dset4 + x /g2/dset5 + x /g2/dset6 group : </> and </> 0 differences found diff --git a/tools/h5diff/testfiles/h5diff_20.txt b/tools/h5diff/testfiles/h5diff_20.txt index e383972..b2fda7c 100644 --- a/tools/h5diff/testfiles/h5diff_20.txt +++ b/tools/h5diff/testfiles/h5diff_20.txt @@ -1,4 +1,5 @@ -Comparison not possible: </dset> is of type H5G_DATASET and </g1> is of type H5G_GROUP +</dset> is of type H5G_DATASET and </g1> is of type H5G_GROUP -------------------------------- Some objects are not comparable -------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_200.txt b/tools/h5diff/testfiles/h5diff_200.txt new file mode 100644 index 0000000..56d723d --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_200.txt @@ -0,0 +1,4 @@ +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_201.txt b/tools/h5diff/testfiles/h5diff_201.txt new file mode 100644 index 0000000..599cc2b --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_201.txt @@ -0,0 +1 @@ +</g2/dset1> or </g2/dset2> are empty datasets diff --git a/tools/h5diff/testfiles/h5diff_202.txt b/tools/h5diff/testfiles/h5diff_202.txt new file mode 100644 index 0000000..a881cf5 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_202.txt @@ -0,0 +1,2 @@ +</g2/dset2> is of class H5T_FLOAT and </g2/dset3> is of class H5T_INTEGER +</g2/dset2> has sign H5T_SGN_ERROR and </g2/dset3> has sign H5T_SGN_2 diff --git a/tools/h5diff/testfiles/h5diff_203.txt b/tools/h5diff/testfiles/h5diff_203.txt new file mode 100644 index 0000000..aea1891 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_203.txt @@ -0,0 +1,2 @@ +</g2/dset3> has rank 1, dimensions [6], max dimensions [6] +</g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2] diff --git a/tools/h5diff/testfiles/h5diff_204.txt b/tools/h5diff/testfiles/h5diff_204.txt new file mode 100644 index 0000000..66b9e63 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_204.txt @@ -0,0 +1,2 @@ +</g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2] +</g2/dset5> has rank 2, dimensions [2x2], max dimensions [2x2] diff --git a/tools/h5diff/testfiles/h5diff_205.txt b/tools/h5diff/testfiles/h5diff_205.txt new file mode 100644 index 0000000..f7360ab --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_205.txt @@ -0,0 +1,3 @@ +</g2/dset5> has rank 2, dimensions [2x2], max dimensions [2x2] +</g2/dset6> has rank 2, dimensions [3x2], max dimensions [3x2] +</g2/dset5> has sign H5T_SGN_2 and </g2/dset6> has sign H5T_SGN_NONE diff --git a/tools/h5diff/testfiles/h5diff_21.txt b/tools/h5diff/testfiles/h5diff_21.txt index d5b0443..5518e0c 100644 --- a/tools/h5diff/testfiles/h5diff_21.txt +++ b/tools/h5diff/testfiles/h5diff_21.txt @@ -1,4 +1,5 @@ -Comparison not possible: </dset> is of type H5G_DATASET and </l1> is of type H5G_LINK +</dset> is of type H5G_DATASET and </l1> is of type H5G_LINK -------------------------------- Some objects are not comparable -------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_22.txt b/tools/h5diff/testfiles/h5diff_22.txt index d8714a0..0f9493b 100644 --- a/tools/h5diff/testfiles/h5diff_22.txt +++ b/tools/h5diff/testfiles/h5diff_22.txt @@ -1,4 +1,5 @@ -Comparison not possible: </dset> is of type H5G_DATASET and </t1> is of type H5G_TYPE +</dset> is of type H5G_DATASET and </t1> is of type H5G_TYPE -------------------------------- Some objects are not comparable -------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_57.txt b/tools/h5diff/testfiles/h5diff_57.txt index 590d355..c1a0d64 100644 --- a/tools/h5diff/testfiles/h5diff_57.txt +++ b/tools/h5diff/testfiles/h5diff_57.txt @@ -2,8 +2,9 @@ dataset: </dset7a> and </dset7b> Warning: different storage datatype </dset7a> has file datatype H5T_STD_I8LE </dset7b> has file datatype H5T_STD_U8LE -Comparison not supported: </dset7a> has sign H5T_SGN_2 and </dset7b> has sign H5T_SGN_NONE +</dset7a> has sign H5T_SGN_2 and </dset7b> has sign H5T_SGN_NONE 0 differences found -------------------------------- Some objects are not comparable -------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_600.txt b/tools/h5diff/testfiles/h5diff_600.txt index 22a3155..f6492cd 100644 --- a/tools/h5diff/testfiles/h5diff_600.txt +++ b/tools/h5diff/testfiles/h5diff_600.txt @@ -9,6 +9,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_603.txt b/tools/h5diff/testfiles/h5diff_603.txt index 80ee102..b3a2d91 100644 --- a/tools/h5diff/testfiles/h5diff_603.txt +++ b/tools/h5diff/testfiles/h5diff_603.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_604.txt b/tools/h5diff/testfiles/h5diff_604.txt index acb12b9..f76be67 100644 --- a/tools/h5diff/testfiles/h5diff_604.txt +++ b/tools/h5diff/testfiles/h5diff_604.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_605.txt b/tools/h5diff/testfiles/h5diff_605.txt index 94f016d..6a5d5cb 100644 --- a/tools/h5diff/testfiles/h5diff_605.txt +++ b/tools/h5diff/testfiles/h5diff_605.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_606.txt b/tools/h5diff/testfiles/h5diff_606.txt index f181030..8338959 100644 --- a/tools/h5diff/testfiles/h5diff_606.txt +++ b/tools/h5diff/testfiles/h5diff_606.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_612.txt b/tools/h5diff/testfiles/h5diff_612.txt index 840058d..ae42501 100644 --- a/tools/h5diff/testfiles/h5diff_612.txt +++ b/tools/h5diff/testfiles/h5diff_612.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_613.txt b/tools/h5diff/testfiles/h5diff_613.txt index 5c18686..a5fbeff 100644 --- a/tools/h5diff/testfiles/h5diff_613.txt +++ b/tools/h5diff/testfiles/h5diff_613.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_614.txt b/tools/h5diff/testfiles/h5diff_614.txt index a630e02..d5716f6 100644 --- a/tools/h5diff/testfiles/h5diff_614.txt +++ b/tools/h5diff/testfiles/h5diff_614.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_615.txt b/tools/h5diff/testfiles/h5diff_615.txt index 8fdc0ce..be344bb 100644 --- a/tools/h5diff/testfiles/h5diff_615.txt +++ b/tools/h5diff/testfiles/h5diff_615.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_621.txt b/tools/h5diff/testfiles/h5diff_621.txt index 746977e..082598e 100644 --- a/tools/h5diff/testfiles/h5diff_621.txt +++ b/tools/h5diff/testfiles/h5diff_621.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_622.txt b/tools/h5diff/testfiles/h5diff_622.txt index 4ead1fb..986b196 100644 --- a/tools/h5diff/testfiles/h5diff_622.txt +++ b/tools/h5diff/testfiles/h5diff_622.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_623.txt b/tools/h5diff/testfiles/h5diff_623.txt index fb94e0d..cba630e 100644 --- a/tools/h5diff/testfiles/h5diff_623.txt +++ b/tools/h5diff/testfiles/h5diff_623.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_624.txt b/tools/h5diff/testfiles/h5diff_624.txt index bb4b133..3a5554f 100644 --- a/tools/h5diff/testfiles/h5diff_624.txt +++ b/tools/h5diff/testfiles/h5diff_624.txt @@ -10,6 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] -r, --report Report mode. Print differences -v, --verbose Verbose mode. Print differences, list of objects -q, --quiet Quiet mode. Do not do output + -c, --compare List objects that are not comparable -N, --nan Avoid NaNs detection -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D diff --git a/tools/h5diff/testfiles/h5diff_70.txt b/tools/h5diff/testfiles/h5diff_70.txt index 87f9beb..42fe6fc 100644 --- a/tools/h5diff/testfiles/h5diff_70.txt +++ b/tools/h5diff/testfiles/h5diff_70.txt @@ -2028,3 +2028,4 @@ position float3D of </g1> float3D of </g1> difference -------------------------------- Some objects are not comparable -------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_80.txt b/tools/h5diff/testfiles/h5diff_80.txt index 9e7af5d..dcabf10 100644 --- a/tools/h5diff/testfiles/h5diff_80.txt +++ b/tools/h5diff/testfiles/h5diff_80.txt @@ -873,3 +873,4 @@ point #4 (2,8) (1,7) -------------------------------- Some objects are not comparable -------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_90.txt b/tools/h5diff/testfiles/h5diff_90.txt index 7007d88..cfef527 100644 --- a/tools/h5diff/testfiles/h5diff_90.txt +++ b/tools/h5diff/testfiles/h5diff_90.txt @@ -7,6 +7,12 @@ file1 file2 x x /g1/dset2 x x /g1/dset4 x x /g2 + x x /g2/dset1 + x x /g2/dset2 + x x /g2/dset3 + x x /g2/dset4 + x x /g2/dset5 + x x /g2/dset6 group : </> and </> 0 differences found @@ -20,3 +26,20 @@ dataset: </g1/dset4> and </g1/dset4> 0 differences found group : </g2> and </g2> 0 differences found +dataset: </g2/dset1> and </g2/dset1> +</g2/dset1> or </g2/dset1> are empty datasets +0 differences found +dataset: </g2/dset2> and </g2/dset2> +0 differences found +dataset: </g2/dset3> and </g2/dset3> +0 differences found +dataset: </g2/dset4> and </g2/dset4> +0 differences found +dataset: </g2/dset5> and </g2/dset5> +0 differences found +dataset: </g2/dset6> and </g2/dset6> +0 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_basic2.h5 b/tools/h5diff/testfiles/h5diff_basic2.h5 Binary files differindex ad45cc0..edb0c65 100644 --- a/tools/h5diff/testfiles/h5diff_basic2.h5 +++ b/tools/h5diff/testfiles/h5diff_basic2.h5 diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index 811b9d8..e37a047 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -578,6 +578,25 @@ TESTING $H5DIFF -v $SRCFILE1 $SRCFILE1 g1/fp1 g1/fp2 TOOLTEST h5diff_102.txt -v $FILE1 $FILE1 g1/fp1 g1/fp2 +# not comparable -c flag +TESTING $H5DIFF $SRCFILE2 $SRCFILE2 g2/dset1 g2/dset2 +TOOLTEST h5diff_200.txt $FILE2 $FILE2 g2/dset1 g2/dset2 + +TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset1 g2/dset2 +TOOLTEST h5diff_201.txt -c $FILE2 $FILE2 g2/dset1 g2/dset2 + +TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset2 g2/dset3 +TOOLTEST h5diff_202.txt -c $FILE2 $FILE2 g2/dset2 g2/dset3 + +TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset3 g2/dset4 +TOOLTEST h5diff_203.txt -c $FILE2 $FILE2 g2/dset3 g2/dset4 + +TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset4 g2/dset5 +TOOLTEST h5diff_204.txt -c $FILE2 $FILE2 g2/dset4 g2/dset5 + +TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset5 g2/dset6 +TOOLTEST h5diff_205.txt -c $FILE2 $FILE2 g2/dset5 g2/dset6 + # ############################################################################## # # END diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index a7d9a05..38c5f54 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -846,10 +846,12 @@ hsize_t diff_compare(hid_t file1_id, /* objects are not the same type */ if (info1->paths[i].type != info2->paths[j].type) { - if (options->m_verbose) - parallel_print("Comparison not possible: <%s> is of type %s and <%s> is of type %s\n", + if (options->m_verbose||options->m_list_not_cmp) + { + parallel_print("<%s> is of type %s and <%s> is of type %s\n", obj1_name, get_type(info1->paths[i].type), obj2_name, get_type(info2->paths[j].type)); + } options->not_cmp=1; return 0; } diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 57d06a5..9028ce5 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -35,10 +35,11 @@ typedef struct { int n; /* count, compare up to count */ hsize_t count; /* count value */ int err_stat; /* an error ocurred (1, error, 0, no error) */ - int cmn_objs; /* do we have comparable objects */ + int cmn_objs; /* do we have common objects */ int not_cmp; /* are the objects comparable */ int contents; /* equal contents */ int do_nans; /* consider Nans while diffing floats */ + int m_list_not_cmp; /* list not comparable messages */ } diff_opt_t; diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 5481d23..8d733b3 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -831,7 +831,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); } - options->not_cmp=1; nfound++; } @@ -861,7 +860,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); } - options->not_cmp=1; nfound++; } @@ -930,7 +928,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); } - options->not_cmp=1; nfound++; } @@ -960,7 +957,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); } - options->not_cmp=1; nfound++; } @@ -1031,7 +1027,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); } - options->not_cmp=1; nfound++; } @@ -1061,7 +1056,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); } - options->not_cmp=1; nfound++; } @@ -1134,7 +1128,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, PDIFF(temp1_ushort,temp2_ushort)); } - options->not_cmp=1; nfound++; } @@ -1164,7 +1157,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); } - options->not_cmp=1; nfound++; } @@ -1234,7 +1226,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); } - options->not_cmp=1; nfound++; } @@ -1264,7 +1255,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); } - options->not_cmp=1; nfound++; } @@ -1334,7 +1324,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); } - options->not_cmp=1; nfound++; } @@ -1364,7 +1353,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); } - options->not_cmp=1; nfound++; } @@ -1435,7 +1423,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, ABS(temp1_long-temp2_long)); } - options->not_cmp=1; nfound++; } @@ -1465,7 +1452,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); } - options->not_cmp=1; nfound++; } @@ -1536,7 +1522,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); } - options->not_cmp=1; nfound++; } @@ -1566,7 +1551,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); } - options->not_cmp=1; nfound++; } @@ -1637,7 +1621,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); } - options->not_cmp=1; nfound++; } @@ -1667,7 +1650,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); } - options->not_cmp=1; nfound++; } @@ -1739,7 +1721,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); } - options->not_cmp=1; nfound++; } @@ -1772,7 +1753,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); } - options->not_cmp=1; nfound++; } @@ -1899,7 +1879,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); } - options->not_cmp=1; nfound++; } @@ -1953,7 +1932,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, ABS(temp1_float-temp2_float)); } - options->not_cmp=1; nfound++; } @@ -2077,7 +2055,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -2130,7 +2107,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -2257,7 +2233,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -2310,7 +2285,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -2863,7 +2837,6 @@ hsize_t diff_float(unsigned char *mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, ABS(temp1_float-temp2_float)); } - options->not_cmp=1; nfound++; } @@ -2925,7 +2898,6 @@ hsize_t diff_float(unsigned char *mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, ABS(temp1_float-temp2_float)); } - options->not_cmp=1; nfound++; } @@ -3073,7 +3045,6 @@ hsize_t diff_double(unsigned char *mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -3118,7 +3089,6 @@ hsize_t diff_double(unsigned char *mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -3252,7 +3222,6 @@ hsize_t diff_ldouble(unsigned char *mem1, parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -3297,7 +3266,6 @@ hsize_t diff_ldouble(unsigned char *mem1, parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -3430,7 +3398,6 @@ hsize_t diff_schar(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, ABS(temp1_char-temp2_char)); } - options->not_cmp=1; nfound++; } @@ -3475,7 +3442,6 @@ hsize_t diff_schar(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, ABS(temp1_char-temp2_char)); } - options->not_cmp=1; nfound++; } @@ -3610,7 +3576,6 @@ hsize_t diff_uchar(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, PDIFF(temp1_uchar,temp2_uchar)); } - options->not_cmp=1; nfound++; } @@ -3655,7 +3620,6 @@ hsize_t diff_uchar(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, PDIFF(temp1_uchar,temp2_uchar)); } - options->not_cmp=1; nfound++; } @@ -3787,7 +3751,6 @@ hsize_t diff_short(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, ABS(temp1_short-temp2_short)); } - options->not_cmp=1; nfound++; } @@ -3834,7 +3797,6 @@ hsize_t diff_short(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, ABS(temp1_short-temp2_short)); } - options->not_cmp=1; nfound++; } @@ -3967,7 +3929,6 @@ hsize_t diff_ushort(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, PDIFF(temp1_ushort,temp2_ushort)); } - options->not_cmp=1; nfound++; } @@ -4014,7 +3975,6 @@ hsize_t diff_ushort(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, PDIFF(temp1_ushort,temp2_ushort)); } - options->not_cmp=1; nfound++; } @@ -4148,7 +4108,6 @@ hsize_t diff_int(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, ABS(temp1_int-temp2_int)); } - options->not_cmp=1; nfound++; } @@ -4195,7 +4154,6 @@ hsize_t diff_int(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, ABS(temp1_int-temp2_int)); } - options->not_cmp=1; nfound++; } @@ -4328,7 +4286,6 @@ hsize_t diff_uint(unsigned char *mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); } - options->not_cmp=1; nfound++; } @@ -4374,7 +4331,6 @@ hsize_t diff_uint(unsigned char *mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); } - options->not_cmp=1; nfound++; } @@ -4511,7 +4467,6 @@ hsize_t diff_long(unsigned char *mem1, parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, ABS(temp1_long-temp2_long)); } - options->not_cmp=1; nfound++; } @@ -4558,7 +4513,6 @@ hsize_t diff_long(unsigned char *mem1, parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, ABS(temp1_long-temp2_long)); } - options->not_cmp=1; nfound++; } @@ -4698,7 +4652,6 @@ hsize_t diff_ulong(unsigned char *mem1, parallel_print(SPACES); parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); } - options->not_cmp=1; nfound++; } @@ -4744,7 +4697,6 @@ hsize_t diff_ulong(unsigned char *mem1, parallel_print(SPACES); parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); } - options->not_cmp=1; nfound++; } @@ -4877,7 +4829,6 @@ hsize_t diff_llong(unsigned char *mem1, parallel_print(SPACES); parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); } - options->not_cmp=1; nfound++; } @@ -4921,7 +4872,6 @@ hsize_t diff_llong(unsigned char *mem1, parallel_print(SPACES); parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); } - options->not_cmp=1; nfound++; } @@ -5055,7 +5005,6 @@ hsize_t diff_ullong(unsigned char *mem1, parallel_print(SPACES); parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); } - options->not_cmp=1; nfound++; } @@ -5101,7 +5050,6 @@ hsize_t diff_ullong(unsigned char *mem1, parallel_print(SPACES); parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); } - options->not_cmp=1; nfound++; } @@ -5449,6 +5397,8 @@ my_isnan(dtype_t type, void *val) double x; HDmemcpy(&x, val, sizeof(double)); retval = (x!=x); + //printf("x=%g retval =%d\n", x,retval); + #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 } else if (FLT_LDOUBLE==type) diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 6dec22b..747b12c 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -150,11 +150,6 @@ hsize_t diff_attr(hid_t loc1_id, options)!=1) { - if (options->m_verbose) - printf("Comparison not possible for attribute <%s>\n", - name1); - - options->not_cmp=1; if (H5Tclose(ftype1_id)<0) goto error; diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 212f089..1a5778a 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -44,7 +44,7 @@ hsize_t diff_dataset( hid_t file1_id, hid_t dcpl1 = -1; hid_t dcpl2 = -1; hsize_t nfound = 0; - + /*------------------------------------------------------------------------- * open the handles *------------------------------------------------------------------------- @@ -102,7 +102,8 @@ hsize_t diff_dataset( hid_t file1_id, H5Dclose(did2); /* enable error reporting */ } H5E_END_TRY; - + + return nfound; error: @@ -206,7 +207,7 @@ hsize_t diff_datasetid( hid_t did1, hsize_t storage_size1; hsize_t storage_size2; hsize_t nfound=0; /* number of differences found */ - int cmp=1; /* do diff or not */ + int can_compare=1; /* do diff or not */ void *buf1=NULL; void *buf2=NULL; void *sm_buf1=NULL; @@ -265,9 +266,9 @@ hsize_t diff_datasetid( hid_t did1, if (storage_size1==0 || storage_size2==0) { - if (options->m_verbose && obj1_name && obj2_name) + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) parallel_print("<%s> or <%s> are empty datasets\n", obj1_name, obj2_name); - cmp=0; + can_compare=0; options->not_cmp=1; } @@ -288,8 +289,7 @@ hsize_t diff_datasetid( hid_t did1, obj2_name, options)!=1) { - cmp=0; - options->not_cmp=1; + can_compare=0; } /*------------------------------------------------------------------------- @@ -314,12 +314,13 @@ hsize_t diff_datasetid( hid_t did1, sign2=H5Tget_sign(m_tid2); if ( sign1 != sign2 ) { - if (options->m_verbose && obj1_name) { - parallel_print("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1)); + if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + { + parallel_print("<%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); } - cmp=0; + can_compare=0; options->not_cmp=1; } @@ -327,7 +328,7 @@ hsize_t diff_datasetid( hid_t did1, * only attempt to compare if possible *------------------------------------------------------------------------- */ - if (cmp) + if (can_compare ) /* it is possible to compare */ { /*------------------------------------------------------------------------- @@ -543,7 +544,7 @@ hsize_t diff_datasetid( hid_t did1, } } /* hyperslab read */ - }/*cmp*/ + }/*can_compare*/ /*------------------------------------------------------------------------- * compare attributes @@ -669,6 +670,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ int maxdim_diff=0; /* maximum dimensions are different */ int dim_diff=0; /* current dimensions are different */ int i; + int can_compare = 1; /* return value */ /*------------------------------------------------------------------------- * check for the same class @@ -683,13 +685,15 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if ( tclass1 != tclass2 ) { - if (options->m_verbose && obj1_name) + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) { - printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n", + parallel_print("<%s> is of class %s and <%s> is of class %s\n", obj1_name, get_class(tclass1), obj2_name, get_class(tclass2) ); } - return 0; + can_compare = 0; + options->not_cmp = 1; + return can_compare; } /*------------------------------------------------------------------------- @@ -714,10 +718,16 @@ int diff_can_type( hid_t f_tid1, /* file data type */ break; default: /*H5T_TIME */ - if (options->m_verbose && obj1_name ) - printf("Comparison not supported: <%s> and <%s> are of class %s\n", - obj1_name,obj2_name,get_class(tclass2) ); - return 0; + + + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + { + parallel_print("<%s> and <%s> are of class %s\n", + obj1_name,obj2_name,get_class(tclass2) ); + } + can_compare = 0; + options->not_cmp = 1; + return can_compare; } /*------------------------------------------------------------------------- @@ -725,21 +735,26 @@ int diff_can_type( hid_t f_tid1, /* file data type */ *------------------------------------------------------------------------- */ - if ( (H5Tequal(f_tid1, f_tid2)==0) && options->m_verbose && obj1_name) + if ( (H5Tequal(f_tid1, f_tid2)==0) && + (options->m_verbose) && obj1_name && obj2_name) { H5T_class_t cl = H5Tget_class(f_tid1); - - printf("Warning: different storage datatype\n"); + + + parallel_print("Warning: different storage datatype\n"); if ( cl == H5T_INTEGER || cl == H5T_FLOAT ) { - printf("<%s> has file datatype ", obj1_name); + parallel_print("<%s> has file datatype ", obj1_name); print_type(f_tid1); - printf("\n"); - printf("<%s> has file datatype ", obj2_name); + parallel_print("\n"); + parallel_print("<%s> has file datatype ", obj2_name); print_type(f_tid2); - printf("\n"); + parallel_print("\n"); } + + + } /*------------------------------------------------------------------------- @@ -749,18 +764,24 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if ( rank1 != rank2 ) { - if (options->m_verbose && obj1_name) { - printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1); + + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + { + parallel_print("<%s> has rank %d, dimensions ", obj1_name, rank1); print_dimensions(rank1,dims1); - printf(", max dimensions "); + parallel_print(", max dimensions "); print_dimensions(rank1,maxdim1); - printf("\n" ); - printf("<%s> has rank %d, dimensions ", obj2_name, rank2); + parallel_print("\n" ); + parallel_print("<%s> has rank %d, dimensions ", obj2_name, rank2); print_dimensions(rank2,dims2); - printf(", max dimensions "); + parallel_print(", max dimensions "); print_dimensions(rank2,maxdim2); + parallel_print("\n"); } - return 0; + + can_compare = 0; + options->not_cmp = 1; + return can_compare; } /*------------------------------------------------------------------------- @@ -787,20 +808,30 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if (dim_diff==1) { - if (options->m_verbose && obj1_name) { - printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1); + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + { + parallel_print("<%s> has rank %d, dimensions ", obj1_name, rank1); print_dimensions(rank1,dims1); - if (maxdim1 && maxdim2) { - printf(", max dimensions "); + if (maxdim1 && maxdim2) + { + parallel_print(", max dimensions "); print_dimensions(rank1,maxdim1); - printf("\n" ); - printf("<%s> has rank %d, dimensions ", obj2_name, rank2); + parallel_print("\n" ); + parallel_print("<%s> has rank %d, dimensions ", obj2_name, rank2); print_dimensions(rank2,dims2); - printf(", max dimensions "); + parallel_print(", max dimensions "); print_dimensions(rank2,maxdim2); + parallel_print("\n"); } } - return 0; + + + can_compare = 0; + options->not_cmp = 1; + return can_compare; + + + } /*------------------------------------------------------------------------- @@ -810,17 +841,17 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if (maxdim1 && maxdim2 && maxdim_diff==1 && obj1_name ) { if (options->m_verbose) { - printf( "Warning: different maximum dimensions\n"); - printf("<%s> has max dimensions ", obj1_name); + parallel_print( "Warning: different maximum dimensions\n"); + parallel_print("<%s> has max dimensions ", obj1_name); print_dimensions(rank1,maxdim1); - printf("\n"); - printf("<%s> has max dimensions ", obj2_name); + parallel_print("\n"); + parallel_print("<%s> has max dimensions ", obj2_name); print_dimensions(rank2,maxdim2); - printf("\n"); + parallel_print("\n"); } } - return 1; + return can_compare; } diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index b8b9f30..35f4dfb 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -148,81 +148,81 @@ void print_type(hid_t type) return; case H5T_INTEGER: if (H5Tequal(type, H5T_STD_I8BE)) { - printf("H5T_STD_I8BE"); + parallel_print("H5T_STD_I8BE"); } else if (H5Tequal(type, H5T_STD_I8LE)) { - printf("H5T_STD_I8LE"); + parallel_print("H5T_STD_I8LE"); } else if (H5Tequal(type, H5T_STD_I16BE)) { - printf("H5T_STD_I16BE"); + parallel_print("H5T_STD_I16BE"); } else if (H5Tequal(type, H5T_STD_I16LE)) { - printf("H5T_STD_I16LE"); + parallel_print("H5T_STD_I16LE"); } else if (H5Tequal(type, H5T_STD_I32BE)) { - printf("H5T_STD_I32BE"); + parallel_print("H5T_STD_I32BE"); } else if (H5Tequal(type, H5T_STD_I32LE)) { - printf("H5T_STD_I32LE"); + parallel_print("H5T_STD_I32LE"); } else if (H5Tequal(type, H5T_STD_I64BE)) { - printf("H5T_STD_I64BE"); + parallel_print("H5T_STD_I64BE"); } else if (H5Tequal(type, H5T_STD_I64LE)) { - printf("H5T_STD_I64LE"); + parallel_print("H5T_STD_I64LE"); } else if (H5Tequal(type, H5T_STD_U8BE)) { - printf("H5T_STD_U8BE"); + parallel_print("H5T_STD_U8BE"); } else if (H5Tequal(type, H5T_STD_U8LE)) { - printf("H5T_STD_U8LE"); + parallel_print("H5T_STD_U8LE"); } else if (H5Tequal(type, H5T_STD_U16BE)) { - printf("H5T_STD_U16BE"); + parallel_print("H5T_STD_U16BE"); } else if (H5Tequal(type, H5T_STD_U16LE)) { - printf("H5T_STD_U16LE"); + parallel_print("H5T_STD_U16LE"); } else if (H5Tequal(type, H5T_STD_U32BE)) { - printf("H5T_STD_U32BE"); + parallel_print("H5T_STD_U32BE"); } else if (H5Tequal(type, H5T_STD_U32LE)) { - printf("H5T_STD_U32LE"); + parallel_print("H5T_STD_U32LE"); } else if (H5Tequal(type, H5T_STD_U64BE)) { - printf("H5T_STD_U64BE"); + parallel_print("H5T_STD_U64BE"); } else if (H5Tequal(type, H5T_STD_U64LE)) { - printf("H5T_STD_U64LE"); + parallel_print("H5T_STD_U64LE"); } else if (H5Tequal(type, H5T_NATIVE_SCHAR)) { - printf("H5T_NATIVE_SCHAR"); + parallel_print("H5T_NATIVE_SCHAR"); } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { - printf("H5T_NATIVE_UCHAR"); + parallel_print("H5T_NATIVE_UCHAR"); } else if (H5Tequal(type, H5T_NATIVE_SHORT)) { - printf("H5T_NATIVE_SHORT"); + parallel_print("H5T_NATIVE_SHORT"); } else if (H5Tequal(type, H5T_NATIVE_USHORT)) { - printf("H5T_NATIVE_USHORT"); + parallel_print("H5T_NATIVE_USHORT"); } else if (H5Tequal(type, H5T_NATIVE_INT)) { - printf("H5T_NATIVE_INT"); + parallel_print("H5T_NATIVE_INT"); } else if (H5Tequal(type, H5T_NATIVE_UINT)) { - printf("H5T_NATIVE_UINT"); + parallel_print("H5T_NATIVE_UINT"); } else if (H5Tequal(type, H5T_NATIVE_LONG)) { - printf("H5T_NATIVE_LONG"); + parallel_print("H5T_NATIVE_LONG"); } else if (H5Tequal(type, H5T_NATIVE_ULONG)) { - printf("H5T_NATIVE_ULONG"); + parallel_print("H5T_NATIVE_ULONG"); } else if (H5Tequal(type, H5T_NATIVE_LLONG)) { - printf("H5T_NATIVE_LLONG"); + parallel_print("H5T_NATIVE_LLONG"); } else if (H5Tequal(type, H5T_NATIVE_ULLONG)) { - printf("H5T_NATIVE_ULLONG"); + parallel_print("H5T_NATIVE_ULLONG"); } else { - printf("undefined integer"); + parallel_print("undefined integer"); } break; case H5T_FLOAT: if (H5Tequal(type, H5T_IEEE_F32BE)) { - printf("H5T_IEEE_F32BE"); + parallel_print("H5T_IEEE_F32BE"); } else if (H5Tequal(type, H5T_IEEE_F32LE)) { - printf("H5T_IEEE_F32LE"); + parallel_print("H5T_IEEE_F32LE"); } else if (H5Tequal(type, H5T_IEEE_F64BE)) { - printf("H5T_IEEE_F64BE"); + parallel_print("H5T_IEEE_F64BE"); } else if (H5Tequal(type, H5T_IEEE_F64LE)) { - printf("H5T_IEEE_F64LE"); + parallel_print("H5T_IEEE_F64LE"); } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) { - printf("H5T_NATIVE_FLOAT"); + parallel_print("H5T_NATIVE_FLOAT"); } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { - printf("H5T_NATIVE_DOUBLE"); + parallel_print("H5T_NATIVE_DOUBLE"); #if H5_SIZEOF_LONG_DOUBLE !=0 } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) { - printf("H5T_NATIVE_LDOUBLE"); + parallel_print("H5T_NATIVE_LDOUBLE"); #endif } else { - printf("undefined float"); + parallel_print("undefined float"); } break; |