Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
julia 0.4
BinDeps
Compat
6 changes: 4 additions & 2 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@windows_only begin
import Compat: @static, is_windows, is_apple

@static if is_windows()
error("The shoco C library doesn't support Windows")
end

Expand Down Expand Up @@ -32,7 +34,7 @@ provides(BuildProcess, (@build_steps begin
CreateDirectory(libdir(shoco))
CCompile(joinpath(srcdir(shoco), "shoco-$sha", "shoco.c"),
joinpath(libdir(shoco), "shoco." * BinDeps.shlib_ext),
["-fPIC", "-std=c99", @osx ? "-dynamiclib" : "-shared"], [])
["-fPIC", "-std=c99", is_apple() ? "-dynamiclib" : "-shared"], [])
end)
end
end), shoco)
Expand Down
7 changes: 5 additions & 2 deletions src/Shoco.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ module Shoco

export compress, decompress

if !isdefined(Base, :unsafe_string)
const unsafe_string = bytestring
end

function compress(s::AbstractString)
isempty(s) && return ""
Expand All @@ -28,7 +31,7 @@ module Shoco
compressed = compressed[1:nbytes]
compressed[end] == Cchar(0) || push!(compressed, Cchar(0))

return bytestring(pointer(compressed))
return unsafe_string(pointer(compressed))
end


Expand All @@ -47,6 +50,6 @@ module Shoco
decompressed = decompressed[1:nbytes]
decompressed[end] == Cchar(0) || push!(decompressed, Cchar(0))

return bytestring(pointer(decompressed))
return unsafe_string(pointer(decompressed))
end
end