Skip to content

Commit

Permalink
Merge pull request #24 from yuyichao/0.6
Browse files Browse the repository at this point in the history
Fix depwarns on 0.6
  • Loading branch information
randyzwitch authored Feb 23, 2017
2 parents e490f40 + e117591 commit 3413ecb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ os:
notifications:
email: false
julia:
- 0.3
- 0.4
- 0.5
- nightly
Expand Down
4 changes: 2 additions & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.3
Compat 0.7.20
julia 0.4
Compat 0.17.0
4 changes: 1 addition & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
environment:
matrix:
- JULIAVERSION: "julialang/bin/winnt/x86/0.3/julia-0.3-latest-win32.exe"
- JULIAVERSION: "julialang/bin/winnt/x64/0.3/julia-0.3-latest-win64.exe"
- JULIAVERSION: "julialang/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
- JULIAVERSION: "julialang/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
- JULIAVERSION: "julialang/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
Expand Down Expand Up @@ -35,4 +33,4 @@ build_script:
Pkg.clone(pwd(), \"Codecs\"); Pkg.build(\"Codecs\")"

test_script:
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"Codecs\")"
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"Codecs\")"
26 changes: 13 additions & 13 deletions src/Codecs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using Compat

export encode, decode, Base64, Zlib, BCD

abstract Codec
@compat abstract type Codec end


function encode{T <: Codec}(codec::Type{T}, s::AbstractString)
Expand All @@ -22,7 +22,7 @@ end

# RFC3548/RFC4648 base64 codec

abstract Base64 <: Codec
@compat abstract type Base64 <: Codec end

const b64enc_tbl = UInt8[
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
Expand Down Expand Up @@ -53,11 +53,11 @@ end
function encode(::Type{Base64}, input::Vector{UInt8})
n = length(input)
if n == 0
return Array(UInt8, 0)
return Vector{UInt8}(0)
end

m = @compat Int(4 * ceil(n / 3))
output = Array(UInt8, m)
output = Vector{UInt8}(m)

k = 1
for ii = 1:3:length(input)-2
Expand Down Expand Up @@ -89,7 +89,7 @@ end
function decode(::Type{Base64}, input::Vector{UInt8})
n = length(input)
if n == 0
return Array(UInt8, 0)
return Vector{UInt8}(0)
end

if n % 4 != 0
Expand All @@ -103,7 +103,7 @@ function decode(::Type{Base64}, input::Vector{UInt8})
if input[end - 1] == base64_pad
m -= 1
end
output = Array(UInt8, m)
output = Vector{UInt8}(m)

k = 1
@inbounds for ii = 1:4:length(input)-4
Expand Down Expand Up @@ -156,7 +156,7 @@ end

# Zlib/Gzip

abstract Zlib <: Codec
@compat abstract type Zlib <: Codec end

const Z_NO_FLUSH = 0
const Z_PARTIAL_FLUSH = 1
Expand Down Expand Up @@ -247,8 +247,8 @@ function encode(::Type{Zlib}, input::Vector{UInt8}, level::Integer)
strm.next_in = input
strm.avail_in = length(input)
strm.total_in = length(input)
output = Array(UInt8, 0)
outbuf = Array(UInt8, 1024)
output = Vector{UInt8}(0)
outbuf = Vector{UInt8}(1024)
ret = Z_OK

while ret != Z_STREAM_END
Expand Down Expand Up @@ -297,8 +297,8 @@ function decode(::Type{Zlib}, input::Vector{UInt8})
strm.next_in = input
strm.avail_in = length(input)
strm.total_in = length(input)
output = Array(UInt8, 0)
outbuf = Array(UInt8, 1024)
output = Vector{UInt8}(0)
outbuf = Vector{UInt8}(1024)
ret = Z_OK

while ret != Z_STREAM_END
Expand Down Expand Up @@ -330,7 +330,7 @@ end
# Packed binary-coded decimal (BCD) integers
# Two decimal digits per byte, each represented with 4 bits

abstract BCD <: Codec
@compat abstract type BCD <: Codec end

function encode(::Type{BCD}, i::Integer, bigendian::Bool = false)
if i < 0
Expand All @@ -340,7 +340,7 @@ function encode(::Type{BCD}, i::Integer, bigendian::Bool = false)
ndig += isodd(ndig)
v = digits(i, 10, ndig)
nbytes = @compat trunc(Integer, ndig/2)
out = Array(UInt8, nbytes)
out = Vector{UInt8}(nbytes)
dj = 1-2*bigendian
for i = 1:nbytes
j = bigendian*length(v) + dj*2*(i-1) + 1-bigendian
Expand Down

0 comments on commit 3413ecb

Please sign in to comment.