Skip to content

Commit

Permalink
Expand TranscodingStreams compat (#70)
Browse files Browse the repository at this point in the history
* expand TranscodingStreams compat

* only test 1.6 un Ubuntu
  • Loading branch information
nhz2 authored Sep 1, 2024
1 parent 07b6381 commit 3822239
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- '1'
- '~1.11.0-0'
- 'pre'
os:
- ubuntu-latest
- macOS-13 # intel
- macOS-14 # arm
- windows-latest
arch:
- 'x64'
- 'x86'
- 'aarch64'
exclude:
include:
- os: ubuntu-latest
arch: aarch64
- os: windows-latest
arch: aarch64
- os: macOS-13
version: '1.6'
arch: x64
- os: ubuntu-latest
version: '1.6'
arch: x86
- os: macOS-13
arch: aarch64
- os: macOS-14
arch: x86
- os: macOS-14
version: '1'
arch: x64
- os: macOS-13
version: 'pre'
arch: x64
- os: macOS-14
version: '1.6'
version: '1'
arch: aarch64
- os: macOS-14
version: 'pre'
arch: aarch64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ ArgCheck = "2"
CodecZlib = "0.7"
InputBuffers = "1"
PrecompileTools = "1"
TranscodingStreams = "0.10.5, 0.11"
TranscodingStreams = "0.9, 0.10, 0.11"
Zlib_jll = "1"
julia = "1.6.0"
7 changes: 4 additions & 3 deletions src/writer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,11 @@ function zip_newfile(w::ZipWriter, name::AbstractString;
throw(ArgumentError("compression_method must be Deflate or Store"))
end
pe.bit_flags |= level_bits
w.transcoder = TranscodingStream(codec, io; sharedbuf=false, stop_on_end=true)
pe.method = real_compression_method

write_local_header(io, pe)
# io is a WriteOffsetTracker so it is protected from closing
# the underlying IO, or sharing buffers incorrectly.
w.transcoder = TranscodingStream(codec, io)
w.partial_entry = pe
@assert iswritable(w)
nothing
Expand Down Expand Up @@ -277,7 +278,7 @@ Base.isreadable(w::WriteOffsetTracker) = false

# All writes to the underlying IO go through this function.
# This enables ZipWriter when using zip_writefile to write to any IO that
# supports Base.unsafe_write and Base.isopen
# supports Base.unsafe_write
function Base.unsafe_write(w::WriteOffsetTracker, p::Ptr{UInt8}, n::UInt)::Int
(n > typemax(Int)) && throw(ArgumentError("too many bytes. Tried to write $n bytes"))
(w.offset < 0) && throw(ArgumentError("initial offset was negative"))
Expand Down

0 comments on commit 3822239

Please sign in to comment.