diff --git a/CMakeLists.txt b/CMakeLists.txt index 097ae709..1faf6bc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,7 @@ else() include(FetchContent) FetchContent_Declare(blosc2 GIT_REPOSITORY https://github.com/Blosc/c-blosc2 - GIT_TAG 5a2b0ed9c4d801230c118fbc5811817055b5a3f5 # v2.22.0 + GIT_TAG 011c9e537f28299c536294d842e1a3d0e41db24f # openzl_plugin + miniexpr ) FetchContent_MakeAvailable(blosc2) include_directories("${blosc2_SOURCE_DIR}/include") diff --git a/src/blosc2/__init__.py b/src/blosc2/__init__.py index 12a2a908..e2107a65 100644 --- a/src/blosc2/__init__.py +++ b/src/blosc2/__init__.py @@ -59,6 +59,8 @@ class Codec(Enum): OPENHTJ2K = 36 #: Needs to be installed with ``pip install blosc2-grok`` GROK = 37 + #: Needs to be installed with ``pip install blosc2-openzl`` + OPENZL = 38 class Filter(Enum): diff --git a/src/blosc2/blosc2_ext.pyx b/src/blosc2/blosc2_ext.pyx index 91276883..0856ca9c 100644 --- a/src/blosc2/blosc2_ext.pyx +++ b/src/blosc2/blosc2_ext.pyx @@ -26,7 +26,7 @@ from cpython cimport ( from cpython.pycapsule cimport PyCapsule_GetPointer, PyCapsule_New from cython.operator cimport dereference from libc.stdint cimport uintptr_t -from libc.stdlib cimport free, malloc, realloc +from libc.stdlib cimport free, malloc, realloc, calloc from libc.stdlib cimport abs as c_abs from libc.string cimport memcpy, strcpy, strdup, strlen from libcpp cimport bool as c_bool @@ -206,6 +206,7 @@ cdef extern from "blosc2.h": uint8_t* ttmp size_t ttmp_nbytes blosc2_context* ctx + c_bool output_is_disposable ctypedef struct blosc2_postfilter_params: void *user_data @@ -252,6 +253,7 @@ cdef extern from "blosc2.h": void* schunk blosc2_postfilter_fn postfilter blosc2_postfilter_params *postparams + int32_t typesize cdef const blosc2_dparams BLOSC2_DPARAMS_DEFAULTS @@ -888,6 +890,7 @@ cdef create_dparams_from_kwargs(blosc2_dparams *dparams, kwargs, blosc2_cparams* dparams.postparams = NULL # TODO: support the next ones in the future #dparams.schunk = kwargs.get('schunk', blosc2.dparams_dflts['schunk']) + #dparams.typesize = typesize = kwargs.get('typesize', blosc2.dparams_dflts['typesize']) _check_dparams(dparams, cparams) def decompress2(src, dst=None, **kwargs): @@ -1616,7 +1619,7 @@ cdef class SChunk: cdef blosc2_cparams* cparams = self.schunk.storage.cparams cparams.prefilter = general_filler - cdef blosc2_prefilter_params* preparams = malloc(sizeof(blosc2_prefilter_params)) + cdef blosc2_prefilter_params* preparams = calloc(1, sizeof(blosc2_prefilter_params)) cdef filler_udata* fill_udata = malloc(sizeof(filler_udata)) fill_udata.py_func = malloc(strlen(func_id) + 1) strcpy(fill_udata.py_func, func_id) @@ -1649,7 +1652,7 @@ cdef class SChunk: cdef blosc2_cparams* cparams = self.schunk.storage.cparams cparams.prefilter = general_prefilter - cdef blosc2_prefilter_params* preparams = malloc(sizeof(blosc2_prefilter_params)) + cdef blosc2_prefilter_params* preparams = calloc(1, sizeof(blosc2_prefilter_params)) cdef user_filters_udata* pref_udata = malloc(sizeof(user_filters_udata)) pref_udata.py_func = malloc(strlen(func_id) + 1) strcpy(pref_udata.py_func, func_id)