Skip to content

Commit

Permalink
Fix formatting of filters
Browse files Browse the repository at this point in the history
  • Loading branch information
mkitti committed Nov 14, 2024
1 parent 1c0503c commit 682ee29
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion filters/H5Zbitshuffle/src/H5Zbitshuffle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ function H5Z_filter_bitshuffle(
end

size = nbytes_uncomp ÷ elem_size
buf_size_out <= 0 && error("bitshuffle_h5plugin: Non-positive buf_size_out for malloc: $buf_size_out")
buf_size_out <= 0 && error(
"bitshuffle_h5plugin: Non-positive buf_size_out for malloc: $buf_size_out"
)
out_buf = Libc.malloc(buf_size_out)
if out_buf == C_NULL
error(
Expand Down
6 changes: 4 additions & 2 deletions filters/H5Zbzip2/src/H5Zbzip2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ function H5Z_filter_bzip2(
# Decompress

outbuflen = nbytes * 3 + 1
outbuflen <= 0 && error("H5Zbzip2: Non-positive outbuflen for malloc: $outbuflen.")
outbuflen <= 0 &&
error("H5Zbzip2: Non-positive outbuflen for malloc: $outbuflen.")
outbuf = Libc.malloc(outbuflen)
if outbuf == C_NULL
error("H5Zbzip2: memory allocation failed for bzip2 decompression.")
Expand Down Expand Up @@ -107,7 +108,8 @@ function H5Z_filter_bzip2(

# Prepare the output buffer
outbuflen = nbytes + nbytes ÷ 100 + 600 # worse case (bzip2 docs)
outbuflen <= 0 && error("H5Zbzip2: Non-positive outbuflen for malloc: $outbuflen.")
outbuflen <= 0 &&
error("H5Zbzip2: Non-positive outbuflen for malloc: $outbuflen.")
outbuf = Libc.malloc(outbuflen)
@debug "Allocated" outbuflen outbuf
if outbuf == C_NULL
Expand Down
3 changes: 2 additions & 1 deletion filters/H5Zlz4/src/H5Zlz4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ function H5Z_filter_lz4(
nBlocks = (nbytes - 1) ÷ blockSize + 1
maxDestSize =
nBlocks * CodecLz4.LZ4_compressBound(blockSize) + 4 + 8 + nBlocks * 4
maxDestSize <= 0 && error("H5Zlz4: Non-positive maxDestSize for malloc: $maxDestSize")
maxDestSize <= 0 &&
error("H5Zlz4: Non-positive maxDestSize for malloc: $maxDestSize")
outBuf = Libc.malloc(maxDestSize)
outBuf == C_NULL && error("H5Zlz4: Could not allocate memory via malloc")

Expand Down

0 comments on commit 682ee29

Please sign in to comment.