diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index d260d37..09b94c2 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -6,6 +6,10 @@ :Contact: francesc@blosc.org :URL: http://www.blosc.org +Changes from 1.0.0 to 1.1.0 +=========================== +- Use H5allocate_memory() and H5free_memory() rather than malloc() and free(). +- Simplified blosc_plugin.c, removed blosc_plugin.h. Changes from 0.0.1 to 1.0.0 =========================== diff --git a/src/blosc_filter.c b/src/blosc_filter.c index bfd8c3e..15e5012 100644 --- a/src/blosc_filter.c +++ b/src/blosc_filter.c @@ -37,23 +37,23 @@ size_t blosc_filter(unsigned flags, size_t cd_nelmts, herr_t blosc_set_local(hid_t dcpl, hid_t type, hid_t space); +H5Z_class_t BLOSC_FILTER[1] = {{ + H5Z_CLASS_T_VERS, + (H5Z_filter_t)(FILTER_BLOSC), + 1, 1, + "blosc", + NULL, + (H5Z_set_local_func_t)(blosc_set_local), + (H5Z_func_t)(blosc_filter) +}}; + /* Register the filter, passing on the HDF5 return value */ int register_blosc(char **version, char **date){ int retval; - H5Z_class_t filter_class = { - H5Z_CLASS_T_VERS, - (H5Z_filter_t)(FILTER_BLOSC), - 1, 1, - "blosc", - NULL, - (H5Z_set_local_func_t)(blosc_set_local), - (H5Z_func_t)(blosc_filter) - }; - - retval = H5Zregister(&filter_class); + retval = H5Zregister(BLOSC_FILTER); if(retval<0){ PUSH_ERR("register_blosc", H5E_CANTREGISTER, "Can't register Blosc filter"); } @@ -157,7 +157,6 @@ size_t blosc_filter(unsigned flags, size_t cd_nelmts, int code; char* compname = "blosclz"; /* The compressor by default */ char* complist; - char errmsg[256]; /* Filter params that are always set */ typesize = cd_values[2]; /* The datatype size */ @@ -207,7 +206,7 @@ size_t blosc_filter(unsigned flags, size_t cd_nelmts, nbytes, outbuf_size); #endif - outbuf = malloc(outbuf_size); + outbuf = H5allocate_memory(outbuf_size, 0); if (outbuf == NULL) { PUSH_ERR("blosc_filter", H5E_CALLBACK, @@ -228,8 +227,6 @@ size_t blosc_filter(unsigned flags, size_t cd_nelmts, /* declare dummy variables */ size_t cbytes, blocksize; - free(outbuf); - /* Extract the exact outbuf_size from the buffer header. * * NOTE: the guess value got from "cd_values" corresponds to the @@ -243,7 +240,7 @@ size_t blosc_filter(unsigned flags, size_t cd_nelmts, fprintf(stderr, "Blosc: Decompress %zd chunk w/buffer %zd\n", nbytes, outbuf_size); #endif - outbuf = malloc(outbuf_size); + outbuf = H5allocate_memory(outbuf_size, 0); if (outbuf == NULL) { PUSH_ERR("blosc_filter", H5E_CALLBACK, "Can't allocate decompression buffer"); @@ -259,14 +256,14 @@ size_t blosc_filter(unsigned flags, size_t cd_nelmts, } /* compressing vs decompressing */ if (status != 0) { - free(*buf); + H5free_memory(*buf); *buf = outbuf; *buf_size = outbuf_size; return status; /* Size of compressed/decompressed data */ } failed: - free(outbuf); + H5free_memory(outbuf); return 0; } /* End filter function */ diff --git a/src/blosc_filter.h b/src/blosc_filter.h index f7f0d3a..6094a51 100644 --- a/src/blosc_filter.h +++ b/src/blosc_filter.h @@ -6,6 +6,7 @@ extern "C" { #endif #include "blosc.h" +#include "hdf5.h" /* Filter revision number, starting at 1 */ /* #define FILTER_BLOSC_VERSION 1 */ @@ -14,11 +15,10 @@ extern "C" { /* Filter ID registered with the HDF Group */ #define FILTER_BLOSC 32001 +H5_DLLVAR H5Z_class_t BLOSC_FILTER[1]; + /* Registers the filter with the HDF5 library. */ -#if defined(_MSC_VER) -__declspec(dllexport) -#endif /* defined(_MSC_VER) */ -int register_blosc(char **version, char **date); +H5_DLL int register_blosc(char **version, char **date); #ifdef __cplusplus } diff --git a/src/blosc_plugin.c b/src/blosc_plugin.c index 10922a8..a605682 100644 --- a/src/blosc_plugin.c +++ b/src/blosc_plugin.c @@ -9,40 +9,8 @@ * */ - -#include - - -#define H5Z_class_t_vers 2 - -#include "blosc_plugin.h" #include "blosc_filter.h" - - -/* Prototypes for filter function in blosc_filter.c. */ -size_t blosc_filter(unsigned flags, size_t cd_nelmts, - const unsigned cd_values[], size_t nbytes, - size_t* buf_size, void** buf); - -herr_t blosc_set_local(hid_t dcpl, hid_t type, hid_t space); - - -H5Z_class_t blosc_H5Filter[1] = { - { - H5Z_CLASS_T_VERS, - (H5Z_filter_t)(FILTER_BLOSC), - 1, /* encoder_present flag (set to true) */ - 1, /* decoder_present flag (set to true) */ - "blosc", - /* Filter info */ - NULL, /* The "can apply" callback */ - (H5Z_set_local_func_t)(blosc_set_local), /* The "set local" callback */ - (H5Z_func_t)(blosc_filter), /* The filter function */ - } -}; - +#include "H5PLextern.h" H5PL_type_t H5PLget_plugin_type(void) { return H5PL_TYPE_FILTER; } - - -const void* H5PLget_plugin_info(void) { return blosc_H5Filter; } +const void* H5PLget_plugin_info(void) { return BLOSC_FILTER; } diff --git a/src/blosc_plugin.h b/src/blosc_plugin.h deleted file mode 100644 index c2295fc..0000000 --- a/src/blosc_plugin.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Dynamically loaded filter plugin for HDF5 blosc filter. - * - * Author: Kiyoshi Masui - * Created: 2014 - * - * - * Header file - * ----------- - * - * This provides dynamically loaded HDF5 filter functionality (introduced - * in HDF5-1.8.11, May 2013) to the blosc HDF5 filter. - * - * Usage: compile as a shared library and install either to the default - * search location for HDF5 filter plugins (on Linux - * /usr/local/hdf5/lib/plugin) or to a location pointed to by the - * HDF5_PLUGIN_PATH environment variable. - * - */ - - -#ifndef PLUGIN_BLOSC_H -#define PLUGIN_BLOSC_H - -#include "H5PLextern.h" - - -H5PL_type_t H5PLget_plugin_type(void); - - -const void* H5PLget_plugin_info(void); - - -#endif // PLUGIN_BLOSC_H - -