Skip to content

Commit

Permalink
Fix #145
Browse files Browse the repository at this point in the history
  • Loading branch information
azurefx committed Dec 6, 2018
1 parent 2900579 commit 69206af
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/libmagickwand.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ function readimage(wand::MagickWand, filename::AbstractString)
end

function readimage(wand::MagickWand, stream::IO)
status = ccall((:MagickReadImageFile, libwand), Cint, (Ptr{Cvoid}, Ptr{Cvoid}), wand, Libc.FILE(stream).ptr)
file = Libc.FILE(stream)
status = ccall((:MagickReadImageFile, libwand), Cint, (Ptr{Cvoid}, Ptr{Cvoid}), wand, file.ptr)
close(file)
status == 0 && error(wand)
nothing
end
Expand All @@ -313,7 +315,9 @@ function writeimage(wand::MagickWand, filename::AbstractString)
end

function writeimage(wand::MagickWand, stream::IO)
status = ccall((:MagickWriteImagesFile, libwand), Cint, (Ptr{Cvoid}, Ptr{Cvoid}), wand, Libc.FILE(stream).ptr)
file = Libc.FILE(stream)
status = ccall((:MagickWriteImagesFile, libwand), Cint, (Ptr{Cvoid}, Ptr{Cvoid}), wand, file.ptr)
close(file)
status == 0 && error(wand)
nothing
end
Expand Down

0 comments on commit 69206af

Please sign in to comment.