Skip to content

Commit

Permalink
Remove TranscodingStreams dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 committed Jul 3, 2024
1 parent 3eb59e1 commit bcc6c0b
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 8 deletions.
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ BufferedStreams = "e1450e63-4bb3-523b-b2a4-4ffa8c0fd77d"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"

[compat]
Aqua = "0.8"
BufferedStreams = "1.2"
Dates = "1"
EnumX = "1"
JET = "0.4, 0.5, 0.6, 0.7, 0.8"
TranscodingStreams = "0.9, 0.10"
TOML = "1"
Test = "1"
julia = "1.6"
Expand Down
1 change: 0 additions & 1 deletion src/ProtoBuf.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module ProtoBuf
import EnumX
import TranscodingStreams
import BufferedStreams
using TOML

Expand Down
1 change: 0 additions & 1 deletion src/codec/Codecs.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module Codecs

using BufferedStreams: BufferedOutputStream, BufferedInputStream
using TranscodingStreams: TranscodingStream

@enum(WireType::UInt32, VARINT=0, FIXED64=1, LENGTH_DELIMITED=2, START_GROUP=3, END_GROUP=4, FIXED32=5)

Expand Down
2 changes: 1 addition & 1 deletion src/codec/vbyte.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://discourse.julialang.org/t/allocation-due-to-noinline-for-unsafe-read-and-unsafe-write-in-io-jl/69421
@inline function _unsafe_write(io::S, ref::Ref{T}, nb::Integer) where {T,S<:Union{TranscodingStream,BufferedOutputStream,BufferedInputStream}}
@inline function _unsafe_write(io::S, ref::Ref{T}, nb::Integer) where {T,S<:Union{BufferedOutputStream,BufferedInputStream}}

Check warning on line 2 in src/codec/vbyte.jl

View check run for this annotation

Codecov / codecov/patch

src/codec/vbyte.jl#L2

Added line #L2 was not covered by tests
GC.@preserve ref unsafe_write(io, Base.unsafe_convert(Ref{T}, ref)::Ptr, nb)
end
@noinline _reached_maxsize_error(io::IOBuffer, nb) = throw(ArgumentError("Cannot write $nb bytes to IOBuffer at position $(position(io)) with maxsize $(io.maxsize)"))
Expand Down
2 changes: 0 additions & 2 deletions src/lexing/Lexers.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module Lexers

import ..Tokens
import ..TranscodingStreams

const EOF_CHAR = typemax(Char)

Expand Down Expand Up @@ -45,7 +44,6 @@ end

filepath(l::Lexer) = l.filepath
filepath(io::IOStream) = abspath(io.name[7:end-1])
filepath(io::TranscodingStreams.TranscodingStream) = filepath(io.stream)
filepath(io::IO) = ""
# TODO: print nicer, clickable token locations with this function, esp for errors.
# How to get the Lexers' IO to the tokens' show method?
Expand Down
1 change: 0 additions & 1 deletion test/test_protojl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ end
module TestComplexMessage
using Test
using ProtoBuf
using TranscodingStreams
using BufferedStreams

function roundtrip_iobuffer(input, f_in=identity, f_out=identity)
Expand Down

0 comments on commit bcc6c0b

Please sign in to comment.