diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2009-04-20 19:12:19 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2009-04-20 19:12:19 (GMT) |
commit | 8c074d5c03ccecf3c133208fdc603d55774e880a (patch) | |
tree | 3520d740df8cc3644de5b08244b7628a6d07712c /test/dsets.c | |
parent | b8036fc5f6db4b6ddd528e741697224db7aba23a (diff) | |
download | hdf5-8c074d5c03ccecf3c133208fdc603d55774e880a.zip hdf5-8c074d5c03ccecf3c133208fdc603d55774e880a.tar.gz hdf5-8c074d5c03ccecf3c133208fdc603d55774e880a.tar.bz2 |
[svn-r16807] Purpose: Fix bug 1533
Description:
Previously, there was no versioning for H5Z_class_t. This prevented applications
written for 1.6 using custom filters from being able to use the 1.8 library.
There is now an H5Z_class1_t and H5Z_class2_t to enable compatibility. H5Zregister is
*not* versioned, it determines which version of the struct has been passed in by the
value of the first field (id or version, both are ints).
Tested: jam, linew, smirom (h5committest), jam (--with-default-api-version=v16)
Diffstat (limited to 'test/dsets.c')
-rw-r--r-- | test/dsets.c | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/test/dsets.c b/test/dsets.c index 060816d..78aa999 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -98,6 +98,7 @@ const char *FILENAME[] = { #define DSET_DEPREC_NAME "deprecated" #define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked" #define DSET_DEPREC_NAME_COMPACT "deprecated_compact" +#define DSET_DEPREC_NAME_FILTER "deprecated_filter" #define USER_BLOCK 1024 #define SIXTY_FOUR_KB 65536 @@ -106,6 +107,7 @@ const char *FILENAME[] = { #define H5Z_FILTER_BOGUS 305 #define H5Z_FILTER_CORRUPT 306 #define H5Z_FILTER_BOGUS2 307 +#define H5Z_FILTER_DEPREC 308 /* Flags for testing filters */ #define DISABLE_FLETCHER32 0 @@ -1022,7 +1024,7 @@ test_tconv(hid_t file) } /* This message derives from H5Z */ -const H5Z_class_t H5Z_BOGUS[1] = {{ +const H5Z_class2_t H5Z_BOGUS[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_BOGUS, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ @@ -1196,7 +1198,7 @@ filter_bogus2(unsigned int flags, size_t cd_nelmts, } /* This message derives from H5Z */ -const H5Z_class_t H5Z_CORRUPT[1] = {{ +const H5Z_class2_t H5Z_CORRUPT[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_CORRUPT, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ @@ -4793,7 +4795,7 @@ test_types(hid_t file) } /* This message derives from H5Z */ -const H5Z_class_t H5Z_CAN_APPLY_TEST[1] = {{ +const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{ H5Z_CLASS_T_VERS, H5Z_FILTER_BOGUS, /* Filter id number */ 1, 1, @@ -5153,7 +5155,7 @@ error: /* This message derives from H5Z */ -const H5Z_class_t H5Z_SET_LOCAL_TEST[1] = {{ +const H5Z_class2_t H5Z_SET_LOCAL_TEST[1] = {{ H5Z_CLASS_T_VERS, H5Z_FILTER_BOGUS2, /* Filter id number */ 1, 1, @@ -6181,6 +6183,28 @@ error: } /* end test_random_chunks() */ #ifndef H5_NO_DEPRECATED_SYMBOLS +/* Empty can_apply and set_local callbacks */ +static herr_t +can_apply_deprec(hid_t UNUSED dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id) +{ + return 1; +} + +static herr_t +set_local_deprec(hid_t UNUSED dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id) +{ + return(SUCCEED); +} + +/* Old style H5Z_class_t, essentially a copy of the "bogus" filter */ +const H5Z_class1_t H5Z_DEPREC[1] = {{ + H5Z_FILTER_DEPREC, /* Filter id number */ + "deprec", /* Filter name for debugging */ + can_apply_deprec, /* The "can apply" callback */ + set_local_deprec, /* The "set local" callback */ + filter_bogus, /* The actual filter function */ +}}; + /*------------------------------------------------------------------------- * Function: test_deprec @@ -6198,8 +6222,9 @@ error: static herr_t test_deprec(hid_t file) { - hid_t dataset, space, small_space, create_parms; + hid_t dataset, space, small_space, create_parms, dcpl; hsize_t dims[2], small_dims[2]; + hsize_t deprec_size; herr_t status; hsize_t csize[2]; @@ -6353,6 +6378,16 @@ test_deprec(hid_t file) if((dataset = H5Dopen1(file, DSET_DEPREC_NAME_COMPACT)) < 0) goto error; if(H5Dclose(dataset) < 0) goto error; + /* Test H5Zregister with deprecated H5Z_class1_t */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5Pset_chunk(dcpl, 2, csize) < 0) goto error; + if(H5Zregister(H5Z_DEPREC) < 0) goto error; + if(H5Pset_filter(dcpl, H5Z_FILTER_DEPREC, 0, (size_t)0, NULL) < 0) goto error; + + if(test_filter_internal(file,DSET_DEPREC_NAME_FILTER,dcpl,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&deprec_size) < 0) goto error; + + if(H5Pclose(dcpl) < 0) goto error; + PASSED(); return 0; |