Skip to content

Commit 29d7709

Browse files
committed
Try to compress small buffers too (e.g. zeros)
1 parent 344ae36 commit 29d7709

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

blosc/blosc2.c

-4
Original file line numberDiff line numberDiff line change
@@ -2219,10 +2219,6 @@ static int write_compression_header(blosc2_context* context, bool extended_heade
22192219
/* Compression level 0 means buffer to be memcpy'ed */
22202220
context->header_flags |= (uint8_t)BLOSC_MEMCPYED;
22212221
}
2222-
if (context->sourcesize < BLOSC_MIN_BUFFERSIZE) {
2223-
/* Buffer is too small. Try memcpy'ing. */
2224-
context->header_flags |= (uint8_t)BLOSC_MEMCPYED;
2225-
}
22262222

22272223
bool memcpyed = context->header_flags & (uint8_t)BLOSC_MEMCPYED;
22282224
if (extended_header) {

include/blosc2.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ BLOSC_EXPORT int blosc2_schunk_decompress_chunk(blosc2_schunk *schunk, int64_t n
17261726
*
17271727
* @warning If the super-chunk is backed by a frame that is disk-based, a buffer is allocated for the
17281728
* (compressed) chunk, and hence a free is needed.
1729-
* You can check if the chunk requires a free with the @p needs_free parameter.
1729+
* You can check whether the chunk requires a free with the @p needs_free parameter.
17301730
* If the chunk does not need a free, it means that a pointer to the location in the super-chunk
17311731
* (or the backing in-memory frame) is returned in the @p chunk parameter.
17321732
*
@@ -1751,7 +1751,7 @@ BLOSC_EXPORT int blosc2_schunk_get_chunk(blosc2_schunk *schunk, int64_t nchunk,
17511751
*
17521752
* @warning If the super-chunk is backed by a frame that is disk-based, a buffer is allocated for the
17531753
* (compressed) chunk, and hence a free is needed.
1754-
* You can check if the chunk requires a free with the @p needs_free parameter.
1754+
* You can check whether requires a free with the @p needs_free parameter.
17551755
* If the chunk does not need a free, it means that a pointer to the location in the super-chunk
17561756
* (or the backing in-memory frame) is returned in the @p chunk parameter. In this case the returned
17571757
* chunk is not lazy.

0 commit comments

Comments
 (0)