diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 40cf464..dcf4fff 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -2,7 +2,7 @@ name: CI on: push: branches: - - main + - master tags: ['*'] pull_request: branches: @@ -21,6 +21,7 @@ jobs: matrix: version: - '1.6' + - '1.9' - '1' os: - ubuntu-latest @@ -34,6 +35,7 @@ jobs: with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} + show-versioninfo: true - uses: julia-actions/cache@v1 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 diff --git a/src/lz4_compression.jl b/src/lz4_compression.jl index f5064b3..7a857cd 100644 --- a/src/lz4_compression.jl +++ b/src/lz4_compression.jl @@ -21,9 +21,9 @@ mutable struct SimpleDoubleBuffer next::Bool end -SimpleDoubleBuffer(buf_size::Integer) = SimpleDoubleBuffer(Array{UInt8}(undef, 2, buf_size), false) +SimpleDoubleBuffer(buf_size::Integer) = SimpleDoubleBuffer(Array{UInt8}(undef, buf_size, 2), false) function get_buffer!(db::SimpleDoubleBuffer) - out_buffer = db.buffer[db.next+1, :] + out_buffer = @view(db.buffer[:, db.next+1]) db.next = !db.next # Update index return out_buffer end @@ -148,16 +148,16 @@ function TranscodingStreams.process( input.size == 0 && return (0, 0, :end) try - in_buffer = pointer(get_buffer!(codec.buffer)) + in_buffer = get_buffer!(codec.buffer) data_size = min(input.size, codec.block_size) out_buffer = Vector{UInt8}(undef, LZ4_compressBound(data_size)) - unsafe_copyto!(in_buffer, input.ptr, data_size) + GC.@preserve in_buffer unsafe_copyto!(pointer(in_buffer), input.ptr, data_size) compressed_size = LZ4_compress_fast_continue( codec.streamptr, in_buffer, - pointer(out_buffer), + out_buffer, data_size, length(out_buffer), codec.acceleration, @@ -165,7 +165,7 @@ function TranscodingStreams.process( checkbounds(output, compressed_size + CINT_SIZE) writeint(output, compressed_size) - unsafe_copyto!(output.ptr + CINT_SIZE, pointer(out_buffer), compressed_size) + GC.@preserve out_buffer unsafe_copyto!(output.ptr + CINT_SIZE, pointer(out_buffer), compressed_size) return (data_size, compressed_size + CINT_SIZE, :ok) catch err @@ -287,13 +287,13 @@ function TranscodingStreams.process( decompressed_size = LZ4_decompress_safe_continue( codec.streamptr, input.ptr+CINT_SIZE, - pointer(out_buffer), + out_buffer, data_size, length(out_buffer) ) checkbounds(output, decompressed_size) - unsafe_copyto!(output.ptr, pointer(out_buffer), decompressed_size) + GC.@preserve out_buffer unsafe_copyto!(output.ptr, pointer(out_buffer), decompressed_size) return (data_size + CINT_SIZE, decompressed_size, :ok) catch err