Skip to content

Commit

Permalink
Fix H5Zzstd error reporting and decompressed size behavior (JuliaIO#1151
Browse files Browse the repository at this point in the history
)

* Fix H5Zzstd error reporting and decompressed size behavior

* Remove commented out code

* Use async so that callback function returns properly

* Fix formatting
  • Loading branch information
mkitti authored Jun 2, 2024
1 parent eaf6641 commit 34bf471
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions filters/H5Zzstd/src/H5Zzstd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ function H5Z_filter_zstd(
#decompresssion

decompSize = LibZstd.ZSTD_getDecompressedSize(inbuf, origSize)
if decompSize == 0
error("zstd_h5plugin: Cannot retrieve decompressed chunk size")
end
outbuf = Libc.malloc(decompSize)
if outbuf == C_NULL
error(
Expand Down Expand Up @@ -83,11 +86,11 @@ function H5Z_filter_zstd(
catch e
# "In the case of failure, the return value is 0 (zero) and all pointer arguments are left unchanged."
ret_value = Csize_t(0)
@error "H5Zzstd Non-Fatal ERROR: " err
display(stacktrace(catch_backtrace()))
# Output Julia error via async so we do not task switch during callback
@async @error "H5Zzstd Non-Fatal ERROR: " exception = (e, catch_backtrace())
finally
if outbuf != C_NULL
free(outbuf)
Libc.free(outbuf)
end
end # try catch finally
return Csize_t(ret_value)
Expand Down

0 comments on commit 34bf471

Please sign in to comment.