Skip to content

Commit

Permalink
Merge pull request #16 from yuyichao/0.5-depwarn
Browse files Browse the repository at this point in the history
Fix depwarn on 0.5 for ByteString
  • Loading branch information
staticfloat committed May 8, 2016
2 parents e3a9f84 + 3bf31d4 commit 70b51d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/SHA.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#isdefined(Base, :__precompile__) && __precompile__()
isdefined(Base, :__precompile__) && __precompile__()

module SHA

Expand Down Expand Up @@ -40,12 +40,12 @@ for (f, ctx) in [(:sha1, :SHA1_CTX),
# Our basic function is to process arrays of bytes
function $f(data::Array{UInt8,1})
ctx = $ctx()
update!(ctx, data);
update!(ctx, data)
return digest!(ctx)
end

# ByteStrings are a pretty handy thing to be able to crunch through
$f(str::ByteString) = $f(str.data)
# AbstractStrings are a pretty handy thing to be able to crunch through
$f(str::AbstractString) = $f(convert(Array{UInt8,1}, str))

# Convenience function for IO devices, allows for things like:
# open("test.txt") do f
Expand Down
2 changes: 1 addition & 1 deletion src/sha1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ function transform!(context::SHA1_CTX)
context.state[3] += c
context.state[4] += d
context.state[5] += e
end
end

0 comments on commit 70b51d1

Please sign in to comment.