From d2bfd727ca0e9f298598b723d20faef3edf7b582 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Wed, 12 Feb 2003 15:07:21 -0500 Subject: [svn-r6400] Purpose: Change feature Description: Switch to Fletcher32 from Adler32 checksum Platforms tested: arabica, eirene, modi4 Misc. update: MANIFEST and RELEASE.txt updated. --- MANIFEST | 2 +- configure | 6 +- configure.in | 8 +-- release_docs/RELEASE.txt | 4 +- src/H5FD.c | 8 +-- src/H5Pdcpl.c | 12 ++-- src/H5Ppublic.h | 2 +- src/H5Z.c | 6 +- src/H5Zadler32.c | 139 ---------------------------------------- src/H5Zfletcher32.c | 161 +++++++++++++++++++++++++++++++++++++++++++++++ src/H5Zprivate.h | 2 +- src/H5Zpublic.h | 2 +- src/H5config.h.in | 4 +- src/Makefile.in | 2 +- test/dsets.c | 94 +++++++++++++-------------- 15 files changed, 237 insertions(+), 215 deletions(-) delete mode 100644 src/H5Zadler32.c create mode 100644 src/H5Zfletcher32.c diff --git a/MANIFEST b/MANIFEST index 626e30a..72e9114 100644 --- a/MANIFEST +++ b/MANIFEST @@ -937,7 +937,7 @@ ./src/H5V.c ./src/H5Vprivate.h ./src/H5Z.c -./src/H5Zadler32.c +./src/H5Zfletcher32.c ./src/H5Zdeflate.c ./src/H5Zshuffle.c ./src/H5Zprivate.h diff --git a/configure b/configure index e6dd849..47d306b 100755 --- a/configure +++ b/configure @@ -30436,7 +30436,7 @@ if test "${enable_filters+set}" = set; then fi; -all_filters="shuffle,adler32" +all_filters="shuffle,fletcher32" case "X-$FILTERS" in X-|X-all) FILTERS=$all_filters @@ -30463,10 +30463,10 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi - if test $filter = "ADLER32"; then + if test $filter = "FLETCHER32"; then cat >>confdefs.h <<\_ACEOF -#define HAVE_FILTER_ADLER32 1 +#define HAVE_FILTER_FLETCHER32 1 _ACEOF fi diff --git a/configure.in b/configure.in index 4c6a43c..595515f 100644 --- a/configure.in +++ b/configure.in @@ -1924,7 +1924,7 @@ AC_ARG_ENABLE([filters], AC_SUBST([FILTERS]) dnl Eventually: all_filters="shuffle,foo,bar,baz" -all_filters="shuffle,adler32" +all_filters="shuffle,fletcher32" case "X-$FILTERS" in X-|X-all) FILTERS=$all_filters @@ -1949,9 +1949,9 @@ dnl AC_DEFINE(HAVE_FILTER_SHUFFLE, 1, [Define if support for shuffle filter is enabled]) fi - if test $filter = "ADLER32"; then - AC_DEFINE(HAVE_FILTER_ADLER32, 1, - [Define if support for Adler32 checksum is enabled]) + if test $filter = "FLETCHER32"; then + AC_DEFINE(HAVE_FILTER_FLETCHER32, 1, + [Define if support for Fletcher32 checksum is enabled]) fi done fi diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 202ca58..fc35b0c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -255,8 +255,8 @@ Documentation New Features ============ - * Added Adler32 checksum as a filter in pipeline. It only works in chunked - dataset. SLU - 2003/2/4 + * Added Fletcher32 checksum as a filter in pipeline. It only works in + chunked dataset. SLU - 2003/2/11 * MPICH/MPE instrumentation feature added. Use --enable-mpe to configure it. AKC - 2003/1/3 * New functions H5Gget_num_objs, H5Gget_objname_by_idx and H5Gget_objtype_by_idx diff --git a/src/H5FD.c b/src/H5FD.c index c4ff8f8..8c82986 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -1178,7 +1178,7 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) haddr_t ret_value = HADDR_UNDEF; FUNC_ENTER_API(H5FDalloc, HADDR_UNDEF); - H5TRACE3("a","xMth",file,type,size); + H5TRACE4("a","xMtih",file,type,dxpl_id,size); /* Check args */ if (!file || !file->cls) @@ -1704,7 +1704,7 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5FDfree, FAIL); - H5TRACE4("e","xMtah",file,type,addr,size); + H5TRACE5("e","xMtiah",file,type,dxpl_id,addr,size); /* Check args */ if (!file || !file->cls) @@ -1985,7 +1985,7 @@ H5FDrealloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsiz haddr_t ret_value=HADDR_UNDEF; FUNC_ENTER_API(H5FDrealloc, HADDR_UNDEF); - H5TRACE5("a","xMtahh",file,type,old_addr,old_size,new_size); + H5TRACE6("a","xMtiahh",file,type,dxpl_id,old_addr,old_size,new_size); /* Check args */ if (H5P_DEFAULT == dxpl_id) @@ -2870,7 +2870,7 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, unsigned closing) herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5FDflush, FAIL); - H5TRACE2("e","xIu",file,closing); + H5TRACE3("e","xiIu",file,dxpl_id,closing); /* Check args */ if (!file || !file->cls) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index efcd8c6..708506c 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -802,9 +802,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_adler32 + * Function: H5Pset_fletcher32 * - * Purpose: Sets Adler32 checksum of EDC for a dataset creation + * Purpose: Sets Fletcher32 checksum of EDC for a dataset creation * property list. * * Return: Non-negative on success/Negative on failure @@ -817,23 +817,23 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pset_adler32(hid_t plist_id) +H5Pset_fletcher32(hid_t plist_id) { H5O_pline_t pline; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ - FUNC_ENTER_API(H5Pset_adler32, FAIL); + FUNC_ENTER_API(H5Pset_fletcher32, FAIL); H5TRACE1("e","i",plist_id); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - /* Add the Adler32 checksum as a filter */ + /* Add the Fletcher32 checksum as a filter */ if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); - if(H5Z_append(&pline, H5Z_FILTER_ADLER32, H5Z_FLAG_MANDATORY, 0, NULL)<0) + if(H5Z_append(&pline, H5Z_FILTER_FLETCHER32, H5Z_FLAG_MANDATORY, 0, NULL)<0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add deflate filter to pipeline"); if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline"); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index fbe1aea..58bd95f 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -219,7 +219,7 @@ H5_DLL H5Z_filter_t H5Pget_filter(hid_t plist_id, int filter, size_t namelen, char name[]); H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned aggression); H5_DLL herr_t H5Pset_shuffle(hid_t plist_id, unsigned bytespertype); -H5_DLL herr_t H5Pset_adler32(hid_t plist_id); +H5_DLL herr_t H5Pset_fletcher32(hid_t plist_id); H5_DLL herr_t H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check); H5_DLL H5Z_EDC_t H5Pget_edc_check(hid_t plist_id); H5_DLL herr_t H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, diff --git a/src/H5Z.c b/src/H5Z.c index c37be31..76fdfd6 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -52,9 +52,9 @@ H5Z_init_interface (void) #ifdef H5_HAVE_FILTER_SHUFFLE H5Z_register (H5Z_FILTER_SHUFFLE, "shuffle", H5Z_filter_shuffle); #endif /* H5_HAVE_FILTER_SHUFFLE */ -#ifdef H5_HAVE_FILTER_ADLER32 - H5Z_register (H5Z_FILTER_ADLER32, "adler32", H5Z_filter_adler32); -#endif /* H5_HAVE_FILTER_ADLER32 */ +#ifdef H5_HAVE_FILTER_FLETCHER32 + H5Z_register (H5Z_FILTER_FLETCHER32, "fletcher32", H5Z_filter_fletcher32); +#endif /* H5_HAVE_FILTER_FLETCHER32 */ FUNC_LEAVE_NOAPI(SUCCEED); } diff --git a/src/H5Zadler32.c b/src/H5Zadler32.c deleted file mode 100644 index 9f380e5..0000000 --- a/src/H5Zadler32.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright © 1999-2001 NCSA - * All rights reserved. - * - * Programmer: Raymond Lu - * Jan 3, 2003 - */ -#include "H5private.h" -#include "H5Eprivate.h" -#include "H5MMprivate.h" -#include "H5Zprivate.h" - -#ifdef H5_HAVE_FILTER_ADLER32 - -#define ADLER_LEN 4 -#define ADLER_BASE 65521 - -/* Interface initialization */ -#define PABLO_MASK H5Z_adler32_mask -#define INTERFACE_INIT NULL -static int interface_initialize_g = 0; - - -/*------------------------------------------------------------------------- - * Function: H5Z_filter_adler32_compute - * - * Purpose: Implement an Adler32 Checksum - * - * Return: Success: Adler32 value - * - * Failure: Can't fail - * - * Programmer: Raymond Lu - * Jan 3, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static unsigned int H5Z_filter_adler32_compute(unsigned char *buf, size_t len) -{ - size_t i; - register unsigned int s1 = 1; - register unsigned int s2 = 0; - - FUNC_ENTER_NOINIT(H5Z_filter_adler32_compute); - - /* Compute checksum */ - for(i=0; i + * Jan 3, 2003 + */ +#include "H5private.h" +#include "H5Eprivate.h" +#include "H5MMprivate.h" +#include "H5Zprivate.h" + +#ifdef H5_HAVE_FILTER_FLETCHER32 + +#define FLETCHER_LEN 4 + +/* Interface initialization */ +#define PABLO_MASK H5Z_fletcher32_mask +#define INTERFACE_INIT NULL +static int interface_initialize_g = 0; + + +/*------------------------------------------------------------------------- + * Function: H5Z_filter_fletcher32_compute + * + * Purpose: Implement an Fletcher32 Checksum using 1's complement. + * + * Return: Success: Fletcher32 value + * + * Failure: Can't fail + * + * Programmer: Raymond Lu + * Jan 3, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static unsigned int H5Z_filter_fletcher32_compute(unsigned short *buf, size_t len) +{ + size_t count = len; + register unsigned int s1 = 0; + register unsigned int s2 = 0; + unsigned short *src = buf; + + FUNC_ENTER_NOINIT(H5Z_filter_fletcher32_compute); + + /* Compute checksum */ + while(count > 1) { + s1 += *src++; + if(s1 & 0xFFFF0000) { /*Wrap around carry if occurred*/ + s1 &= 0xFFFF; + s1++; + } + s2 += s1; + if(s2 & 0xFFFF0000) { /*Wrap around carry if occurred*/ + s2 &= 0xFFFF; + s2++; + } + count -= 2; + } + + if(count==1) { + s1 += *(unsigned char*)src; + if(s1 & 0xFFFF0000) { /*Wrap around carry if occurred*/ + s1 &= 0xFFFF; + s1++; + } + s2 += s1; + if(s2 & 0xFFFF0000) { /*Wrap around carry if occurred*/ + s2 &= 0xFFFF; + s2++; + } + } + + FUNC_LEAVE_NOAPI((s2 << 16) + s1); +} + + +/*------------------------------------------------------------------------- + * Function: H5Z_filter_fletcher32 + * + * Purpose: Implement an I/O filter of Fletcher32 Checksum + * + * Return: Success: size of data plus the size of Fletcher32 value + * + * Failure: 0 + * + * Programmer: Raymond Lu + * Jan 3, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +size_t +H5Z_filter_fletcher32 (unsigned flags, size_t cd_nelmts, const unsigned cd_values[], + size_t nbytes, size_t *buf_size, void **buf) +{ + size_t ret_value = 0; + void *outbuf = NULL; + + unsigned char *src = (unsigned char*)(*buf); + unsigned int fletcher = 0; + + FUNC_ENTER_NOAPI(H5Z_filter_fletcher32, 0); + + assert(sizeof(unsigned int)==4); + + if (flags & H5Z_FLAG_REVERSE) { /* Read */ + size_t src_nbytes = nbytes; + unsigned int origin_fletcher; + + /* Do checksum if it's enabled for read; otherwise skip it + * to save performance. */ + if (!(flags & H5Z_FLAG_SKIP_EDC)) { /* Read */ + unsigned char *tmp_src; + + src_nbytes -= FLETCHER_LEN; + tmp_src=src+src_nbytes; + UINT32DECODE(tmp_src, origin_fletcher); + + /* Compute checksum */ + fletcher = H5Z_filter_fletcher32_compute((unsigned short*)src,src_nbytes); + + if(origin_fletcher != fletcher) + HGOTO_ERROR(H5E_STORAGE, H5E_READERROR, 0, "data error detected by Fletcher32 checksum"); + } + + *buf_size = nbytes - FLETCHER_LEN; + ret_value = *buf_size; + } else { /* Write */ + unsigned char *dst; + + /* Compute checksum */ + fletcher = H5Z_filter_fletcher32_compute((unsigned short*)src,nbytes); + + if (NULL==(dst=outbuf=H5MM_malloc(nbytes+FLETCHER_LEN))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate Fletcher32 checksum destination buffer"); + + /* Copy raw data */ + HDmemcpy((void*)dst, (void*)(*buf), nbytes); + + /* Append checksum to raw data */ + dst += nbytes; + UINT32ENCODE(dst, fletcher); + + *buf_size = nbytes + FLETCHER_LEN; + H5MM_xfree(*buf); + *buf = outbuf; + outbuf = NULL; + ret_value = *buf_size; + } + +done: + if(outbuf) + H5MM_xfree(outbuf); + FUNC_LEAVE_NOAPI(ret_value); +} + +#endif /* H5_HAVE_FILTER_FLETCHER32 */ diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h index b150d0f..be87d9e 100644 --- a/src/H5Zprivate.h +++ b/src/H5Zprivate.h @@ -55,7 +55,7 @@ H5_DLL size_t H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); -H5_DLL size_t H5Z_filter_adler32(unsigned flags, size_t cd_nelmts, +H5_DLL size_t H5Z_filter_fletcher32(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t nbytes, size_t *buf_size, void **buf); diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h index f45c96c..3acf54d 100644 --- a/src/H5Zpublic.h +++ b/src/H5Zpublic.h @@ -20,7 +20,7 @@ typedef int H5Z_filter_t; #define H5Z_FILTER_NONE 0 /*reserved indefinitely */ #define H5Z_FILTER_DEFLATE 1 /*deflation like gzip */ #define H5Z_FILTER_SHUFFLE 2 /*shuffle the data */ -#define H5Z_FILTER_ADLER32 3 /*adler32 checksum of EDC */ +#define H5Z_FILTER_FLETCHER32 3 /*fletcher32 checksum of EDC */ #define H5Z_FILTER_RESERVED 256 /*filter ids below this value are reserved */ #define H5Z_FILTER_MAX 65535 /*maximum filter id */ diff --git a/src/H5config.h.in b/src/H5config.h.in index 4ac1519..9397a22 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -21,8 +21,8 @@ /* Define to 1 if you have the header file. */ #undef HAVE_FEATURES_H -/* Define if support for Adler32 checksum is enabled */ -#undef HAVE_FILTER_ADLER32 +/* Define if support for Fletcher32 checksum is enabled */ +#undef HAVE_FILTER_FLETCHER32 /* Define if support for deflate filter is enabled */ #undef HAVE_FILTER_DEFLATE diff --git a/src/Makefile.in b/src/Makefile.in index e8aab01..92a1ee9 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -42,7 +42,7 @@ LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fcontig.c \ H5Tcompound.c H5Tconv.c H5Tcset.c H5Tenum.c H5Tfields.c H5Tfixed.c \ H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Topaque.c H5Torder.c \ H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvlen.c H5TB.c H5TS.c H5V.c H5Z.c \ - H5Zdeflate.c H5Zshuffle.c H5Zadler32.c + H5Zdeflate.c H5Zshuffle.c H5Zfletcher32.c LIB_OBJ=$(LIB_SRC:.c=.lo) diff --git a/test/dsets.c b/test/dsets.c index a6398ea..ee17690 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -28,11 +28,11 @@ const char *FILENAME[] = { #define DSET_TCONV_NAME "tconv" #define DSET_DEFLATE_NAME "deflate" #define DSET_SHUFFLE_NAME "shuffle" -#define DSET_ADLER32_NAME "adler32" -#define DSET_ADLER32_NAME_2 "adler32_2" -#define DSET_ADLER32_NAME_3 "adler32_3" -#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+adler32" -#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+adler32_2" +#define DSET_FLETCHER32_NAME "fletcher32" +#define DSET_FLETCHER32_NAME_2 "fletcher32_2" +#define DSET_FLETCHER32_NAME_3 "fletcher32_3" +#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32" +#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2" #define DSET_BOGUS_NAME "bogus" #define DSET_MISSING_NAME "missing" #define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle" @@ -41,8 +41,8 @@ const char *FILENAME[] = { #define H5Z_BOGUS 305 #define H5Z_CORRUPT 306 -#define DISABLE_ADLER32 0 -#define ENABLE_ADLER32 1 +#define DISABLE_FLETCHER32 0 +#define ENABLE_FLETCHER32 1 #define DATA_CORRUPTED 1 #define DATA_NOT_CORRUPTED 0 @@ -615,7 +615,7 @@ bogus(unsigned int UNUSED flags, size_t UNUSED cd_nelmts, /*------------------------------------------------------------------------- * Function: corrupt_data * - * Purpose: For testing Adler32 checksum. modify data slightly during + * Purpose: For testing Fletcher32 checksum. modify data slightly during * writing so that when data is read back, the checksum should * fail. * @@ -690,7 +690,7 @@ static H5Z_cb_return_t filter_cb_cont(H5Z_filter_t filter, void* UNUSED buf, size_t UNUSED buf_size, void* UNUSED op_data) { - if(H5Z_FILTER_ADLER32==filter) + if(H5Z_FILTER_FLETCHER32==filter) return H5Z_CB_CONT; else return H5Z_CB_FAIL; @@ -715,7 +715,7 @@ static H5Z_cb_return_t filter_cb_fail(H5Z_filter_t filter, void* UNUSED buf, size_t UNUSED buf_size, void* UNUSED op_data) { - if(H5Z_FILTER_ADLER32==filter) + if(H5Z_FILTER_FLETCHER32==filter) return H5Z_CB_FAIL; else return H5Z_CB_CONT; @@ -743,7 +743,7 @@ filter_cb_fail(H5Z_filter_t filter, void* UNUSED buf, size_t UNUSED buf_size, *------------------------------------------------------------------------- */ static herr_t -test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_adler32, +test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, int corrupted, hsize_t *dset_size) { hid_t dataset; /* Dataset ID */ @@ -766,7 +766,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_adler32, if ((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) goto error; tconv_buf = malloc (1000); if (H5Pset_buffer (dxpl, 1000, tconv_buf, NULL)<0) goto error; - if (if_adler32==DISABLE_ADLER32) { + if (if_fletcher32==DISABLE_FLETCHER32) { if(H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)<0) goto error; if(H5Z_DISABLE_EDC != H5Pget_edc_check(dxpl)) @@ -1064,10 +1064,10 @@ error: * * Modifications: * Moved guts of filter testing out of main routine. - * Tests shuffle, deflate, adler32 checksum filters. + * Tests shuffle, deflate, fletcher32 checksum filters. * Quincey Koziol, November 14, 2002 * - * Added Adler32 filter testing + * Added Fletcher32 filter testing * Raymond Lu, Jan 22, 2002 * *------------------------------------------------------------------------- @@ -1078,19 +1078,19 @@ test_filters(hid_t file) hid_t dc; /* Dataset creation property list ID */ const hsize_t chunk_size[2] = {2, 25}; /* Chunk dimensions */ hsize_t null_size; /* Size of dataset with null filter */ -#ifdef H5_HAVE_FILTER_ADLER32 - hsize_t adler32_size; /* Size of dataset with Adler32 checksum */ +#ifdef H5_HAVE_FILTER_FLETCHER32 + hsize_t fletcher32_size; /* Size of dataset with Fletcher32 checksum */ unsigned data_corrupt[3]; /* position and length of data to be corrupted */ -#endif /* H5_HAVE_FILTER_ADLER32 */ +#endif /* H5_HAVE_FILTER_FLETCHER32 */ #ifdef H5_HAVE_FILTER_DEFLATE hsize_t deflate_size; /* Size of dataset with deflate filter */ #endif /* H5_HAVE_FILTER_DEFLATE */ #ifdef H5_HAVE_FILTER_SHUFFLE hsize_t shuffle_size; /* Size of dataset with shuffle filter */ #endif /* H5_HAVE_FILTER_SHUFFLE */ -#if defined H5_HAVE_FILTER_DEFLATE && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_ADLER32 +#if defined H5_HAVE_FILTER_DEFLATE && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32 hsize_t combo_size; /* Size of dataset with shuffle+deflate filter */ -#endif /* H5_HAVE_FILTER_DEFLATE && H5_HAVE_FILTER_SHUFFLE && H5_HAVE_FILTER_ADLER32 */ +#endif /* H5_HAVE_FILTER_DEFLATE && H5_HAVE_FILTER_SHUFFLE && H5_HAVE_FILTER_FLETCHER32 */ /* Test null I/O filter (by itself) */ puts("Testing 'null' filter"); @@ -1099,48 +1099,48 @@ test_filters(hid_t file) if (H5Zregister (H5Z_BOGUS, "bogus", bogus)<0) goto error; if (H5Pset_filter (dc, H5Z_BOGUS, 0, 0, NULL)<0) goto error; - if(test_filter_internal(file,DSET_BOGUS_NAME,dc,DISABLE_ADLER32,DATA_NOT_CORRUPTED,&null_size)<0) goto error; + if(test_filter_internal(file,DSET_BOGUS_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&null_size)<0) goto error; /* Clean up objects used for this test */ if (H5Pclose (dc)<0) goto error; /*---------------------------------------------------------- - * STEP 1: Test Adler32 Checksum by itself. + * STEP 1: Test Fletcher32 Checksum by itself. *---------------------------------------------------------- */ -#ifdef H5_HAVE_FILTER_ADLER32 - puts("Testing Adler32 checksum(enabled for read)"); +#ifdef H5_HAVE_FILTER_FLETCHER32 + puts("Testing Fletcher32 checksum(enabled for read)"); if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error; - if (H5Pset_filter (dc,H5Z_FILTER_ADLER32,0,0,NULL)<0) goto error; + if (H5Pset_filter (dc,H5Z_FILTER_FLETCHER32,0,0,NULL)<0) goto error; /* Enable checksum during read */ - if(test_filter_internal(file,DSET_ADLER32_NAME,dc,ENABLE_ADLER32,DATA_NOT_CORRUPTED,&adler32_size)<0) goto error; - if(adler32_size<=null_size) { + if(test_filter_internal(file,DSET_FLETCHER32_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&fletcher32_size)<0) goto error; + if(fletcher32_size<=null_size) { H5_FAILED(); puts(" Size after checksumming is incorrect."); goto error; } /* end if */ /* Disable checksum during read */ - puts("Testing Adler32 checksum(disabled for read)"); - if(test_filter_internal(file,DSET_ADLER32_NAME_2,dc,DISABLE_ADLER32,DATA_NOT_CORRUPTED,&adler32_size)<0) goto error; - if(adler32_size<=null_size) { + puts("Testing Fletcher32 checksum(disabled for read)"); + if(test_filter_internal(file,DSET_FLETCHER32_NAME_2,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&fletcher32_size)<0) goto error; + if(fletcher32_size<=null_size) { H5_FAILED(); puts(" Size after checksumming is incorrect."); goto error; } /* end if */ /* Try to corrupt data and see if checksum fails */ - puts("Testing Adler32 checksum(when data is corrupted)"); + puts("Testing Fletcher32 checksum(when data is corrupted)"); data_corrupt[0] = 52; data_corrupt[1] = 33; data_corrupt[2] = 27; if (H5Zregister (H5Z_CORRUPT, "corrupt", corrupt_data)<0) goto error; if (H5Pset_filter (dc, H5Z_CORRUPT, 0, 3, data_corrupt)<0) goto error; - if(test_filter_internal(file,DSET_ADLER32_NAME_3,dc,ENABLE_ADLER32,DATA_CORRUPTED,&adler32_size)<0) goto error; - if(adler32_size<=null_size) { + if(test_filter_internal(file,DSET_FLETCHER32_NAME_3,dc,ENABLE_FLETCHER32,DATA_CORRUPTED,&fletcher32_size)<0) goto error; + if(fletcher32_size<=null_size) { H5_FAILED(); puts(" Size after checksumming is incorrect."); goto error; @@ -1148,11 +1148,11 @@ test_filters(hid_t file) /* Clean up objects used for this test */ if (H5Pclose (dc)<0) goto error; -#else /* H5_HAVE_FILTER_ADLER32 */ - TESTING("adler32 checksum"); +#else /* H5_HAVE_FILTER_FLETCHER32 */ + TESTING("fletcher32 checksum"); SKIPPED(); - puts("adler32 checksum not enabled"); -#endif /* H5_HAVE_FILTER_ADLER32 */ + puts("fletcher32 checksum not enabled"); +#endif /* H5_HAVE_FILTER_FLETCHER32 */ /*---------------------------------------------------------- * STEP 2: Test deflation by itself. @@ -1164,7 +1164,7 @@ test_filters(hid_t file) if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error; if (H5Pset_deflate (dc, 6)<0) goto error; - if(test_filter_internal(file,DSET_DEFLATE_NAME,dc,DISABLE_ADLER32,DATA_NOT_CORRUPTED,&deflate_size)<0) goto error; + if(test_filter_internal(file,DSET_DEFLATE_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&deflate_size)<0) goto error; /* Clean up objects used for this test */ if (H5Pclose (dc)<0) goto error; #else /* H5_HAVE_FILTER_DEFLATE */ @@ -1183,7 +1183,7 @@ test_filters(hid_t file) if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error; if (H5Pset_shuffle (dc, sizeof(int))<0) goto error; - if(test_filter_internal(file,DSET_SHUFFLE_NAME,dc,DISABLE_ADLER32,DATA_NOT_CORRUPTED,&shuffle_size)<0) goto error; + if(test_filter_internal(file,DSET_SHUFFLE_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&shuffle_size)<0) goto error; if(shuffle_size!=null_size) { H5_FAILED(); puts(" Shuffled size not the same as uncompressed size."); @@ -1202,15 +1202,15 @@ test_filters(hid_t file) * STEP 4: Test shuffle + deflate + checksum in any order. *---------------------------------------------------------- */ -#if defined H5_HAVE_FILTER_DEFLATE && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_ADLER32 +#if defined H5_HAVE_FILTER_DEFLATE && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32 puts("Testing shuffle+deflate+checksum filters(checksum first)"); if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error; - if (H5Pset_adler32 (dc)<0) goto error; + if (H5Pset_fletcher32 (dc)<0) goto error; if (H5Pset_shuffle (dc, sizeof(int))<0) goto error; if (H5Pset_deflate (dc, 6)<0) goto error; - if(test_filter_internal(file,DSET_SHUF_DEF_FLET_NAME,dc,ENABLE_ADLER32,DATA_NOT_CORRUPTED,&combo_size)<0) goto error; + if(test_filter_internal(file,DSET_SHUF_DEF_FLET_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size)<0) goto error; /* Clean up objects used for this test */ if (H5Pclose (dc)<0) goto error; @@ -1220,17 +1220,17 @@ test_filters(hid_t file) if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error; if (H5Pset_shuffle (dc, sizeof(int))<0) goto error; if (H5Pset_deflate (dc, 6)<0) goto error; - if (H5Pset_adler32 (dc)<0) goto error; + if (H5Pset_fletcher32 (dc)<0) goto error; - if(test_filter_internal(file,DSET_SHUF_DEF_FLET_NAME_2,dc,ENABLE_ADLER32,DATA_NOT_CORRUPTED,&combo_size)<0) goto error; + if(test_filter_internal(file,DSET_SHUF_DEF_FLET_NAME_2,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size)<0) goto error; /* Clean up objects used for this test */ if (H5Pclose (dc)<0) goto error; -#else /* H5_HAVE_FILTER_DEFLATE && H5_HAVE_FILTER_SHUFFLE && H5_HAVE_FILTER_ADLER32 */ - TESTING("shuffle+deflate+adler32 filters"); +#else /* H5_HAVE_FILTER_DEFLATE && H5_HAVE_FILTER_SHUFFLE && H5_HAVE_FILTER_FLETCHER32 */ + TESTING("shuffle+deflate+fletcher32 filters"); SKIPPED(); - puts("Deflate, shuffle, or Adler32 checksum filter not enabled"); -#endif /* H5_HAVE_FILTER_DEFLATE && H5_HAVE_FILTER_SHUFFLE && H5_HAVE_FILTER_ADLER32 */ + puts("Deflate, shuffle, or Fletcher32 checksum filter not enabled"); +#endif /* H5_HAVE_FILTER_DEFLATE && H5_HAVE_FILTER_SHUFFLE && H5_HAVE_FILTER_FLETCHER32 */ return 0; error: -- cgit v0.12