From 67b53707f125b85b2d1830fd83e04bc8cd7b8203 Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Tue, 30 Jan 2024 15:04:09 +0100 Subject: [PATCH] Squashed 'src/c-blosc2/' changes from 97ac7964f..edcf96d4f edcf96d4f Getting ready for release 2.13.1 22177bca1 Remove include blosc-private.h in b2nd.h ef531a46b Revert grok inizialization from c-blosc2 54a23bfbb Move back swap_store from blosc-private.h to blosc2.h c6e8bf60a Post 2.13.0 release actions done git-subtree-dir: src/c-blosc2 git-subtree-split: edcf96d4f1d288db3849abae60c1721ee40e881d --- ANNOUNCE.md | 7 ++----- RELEASE_NOTES.md | 6 ++++++ blosc/blosc-private.h | 40 ------------------------------------ blosc/blosc2.c | 5 ----- include/b2nd.h | 1 - include/blosc2.h | 48 ++++++++++++++++++++++++++++++++++++++++--- 6 files changed, 53 insertions(+), 54 deletions(-) diff --git a/ANNOUNCE.md b/ANNOUNCE.md index c5da8f40..634a3aa3 100644 --- a/ANNOUNCE.md +++ b/ANNOUNCE.md @@ -1,12 +1,9 @@ -# Announcing C-Blosc2 2.13.0 +# Announcing C-Blosc2 2.13.1 A fast, compressed and persistent binary data store library for C. ## What is new? -A new filter for truncating integers has been added. Furthermore, the zstd codec -has been optimized specially when using dicts. And finally, the grok library -will be initialized when loading the plugin. This evicts having to import it in -some use cases. +This is a patch release for fixing a bug regarding the included files in `b2nd.h`. For more info, please see the release notes in: diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index fbf33e18..36f8441d 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,6 +1,12 @@ Release notes for C-Blosc2 ========================== +Changes from 2.13.0 to 2.13.1 +============================= + +* Removed private include in `b2nd.h`. This fixes issue #579. + + Changes from 2.12.0 to 2.13.0 ============================= diff --git a/blosc/blosc-private.h b/blosc/blosc-private.h index f3dd8c60..b6c274ac 100644 --- a/blosc/blosc-private.h +++ b/blosc/blosc-private.h @@ -274,45 +274,5 @@ static inline void* load_lib(char *plugin_name, char *libpath) { return loaded_lib; } -static inline void swap_store(void *dest, const void *pa, int size) { - uint8_t *pa_ = (uint8_t *) pa; - uint8_t *pa2_ = (uint8_t*)malloc((size_t) size); - int i = 1; /* for big/little endian detection */ - char *p = (char *) &i; - - if (p[0] == 1) { - /* little endian */ - switch (size) { - case 8: - pa2_[0] = pa_[7]; - pa2_[1] = pa_[6]; - pa2_[2] = pa_[5]; - pa2_[3] = pa_[4]; - pa2_[4] = pa_[3]; - pa2_[5] = pa_[2]; - pa2_[6] = pa_[1]; - pa2_[7] = pa_[0]; - break; - case 4: - pa2_[0] = pa_[3]; - pa2_[1] = pa_[2]; - pa2_[2] = pa_[1]; - pa2_[3] = pa_[0]; - break; - case 2: - pa2_[0] = pa_[1]; - pa2_[1] = pa_[0]; - break; - case 1: - pa2_[0] = pa_[0]; - break; - default: - fprintf(stderr, "Unhandled nitems: %d\n", size); - } - } - memcpy(dest, pa2_, size); - free(pa2_); -} - #endif /* BLOSC_BLOSC_PRIVATE_H */ diff --git a/blosc/blosc2.c b/blosc/blosc2.c index 95729dba..993ccb1f 100644 --- a/blosc/blosc2.c +++ b/blosc/blosc2.c @@ -843,11 +843,6 @@ int fill_codec(blosc2_codec *codec) { dlclose(lib); return BLOSC2_ERROR_FAILURE; } - if (codec->compcode == BLOSC_CODEC_GROK) { - // Initialize grok lib - void (*init_func)(uint32_t, bool) = dlsym(lib, "blosc2_grok_init"); - (*init_func)(0, false); - } return BLOSC2_ERROR_SUCCESS; } diff --git a/include/b2nd.h b/include/b2nd.h index af8ec1ac..769819f1 100644 --- a/include/b2nd.h +++ b/include/b2nd.h @@ -27,7 +27,6 @@ extern "C" { #endif #include "blosc2.h" -#include "blosc-private.h" #include #include diff --git a/include/blosc2.h b/include/blosc2.h index f8965f43..a8372cdb 100644 --- a/include/blosc2.h +++ b/include/blosc2.h @@ -83,10 +83,10 @@ extern "C" { /* Version numbers */ #define BLOSC2_VERSION_MAJOR 2 /* for major interface/format changes */ #define BLOSC2_VERSION_MINOR 13 /* for minor interface/format changes */ -#define BLOSC2_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */ +#define BLOSC2_VERSION_RELEASE 1 /* for tweaks, bug-fixes, or development */ -#define BLOSC2_VERSION_STRING "2.13.0" /* string version. Sync with above! */ -#define BLOSC2_VERSION_DATE "$Date:: 2023-01-24 #$" /* date version */ +#define BLOSC2_VERSION_STRING "2.13.1" /* string version. Sync with above! */ +#define BLOSC2_VERSION_DATE "$Date:: 2023-01-25 #$" /* date version */ /* The maximum number of dimensions for Blosc2 NDim arrays */ @@ -2504,6 +2504,48 @@ BLOSC_EXPORT void blosc2_multidim_to_unidim(const int64_t *index, int8_t ndim, c */ BLOSC_EXPORT int blosc2_get_slice_nchunks(blosc2_schunk* schunk, int64_t *start, int64_t *stop, int64_t **chunks_idx); + +// Private function needed in b2nd.h for deserializing meta +static inline void swap_store(void *dest, const void *pa, int size) { + uint8_t *pa_ = (uint8_t *) pa; + uint8_t *pa2_ = (uint8_t*)malloc((size_t) size); + int i = 1; /* for big/little endian detection */ + char *p = (char *) &i; + + if (p[0] == 1) { + /* little endian */ + switch (size) { + case 8: + pa2_[0] = pa_[7]; + pa2_[1] = pa_[6]; + pa2_[2] = pa_[5]; + pa2_[3] = pa_[4]; + pa2_[4] = pa_[3]; + pa2_[5] = pa_[2]; + pa2_[6] = pa_[1]; + pa2_[7] = pa_[0]; + break; + case 4: + pa2_[0] = pa_[3]; + pa2_[1] = pa_[2]; + pa2_[2] = pa_[1]; + pa2_[3] = pa_[0]; + break; + case 2: + pa2_[0] = pa_[1]; + pa2_[1] = pa_[0]; + break; + case 1: + pa2_[0] = pa_[0]; + break; + default: + fprintf(stderr, "Unhandled nitems: %d\n", size); + } + } + memcpy(dest, pa2_, size); + free(pa2_); +} + #ifdef __cplusplus } #endif