@@ -5,7 +5,8 @@ import Base: close, eof, flush, read, readall, write
55import Base. Libc: errno, strerror
66export StringEncoder, StringDecoder, encode, decode
77
8- include (" ../deps/deps.jl" )
8+ depsjl = joinpath (dirname (@__FILE__ ), " .." , " deps" , " deps.jl" )
9+ isfile (depsjl) ? include (depsjl) : error (" libiconv not properly installed. Please run\n Pkg.build(\" iconv\" )" )
910
1011
1112# # iconv wrappers
@@ -16,13 +17,13 @@ const EILSEQ = 84
1617
1718function iconv_close (cd:: Ptr{Void} )
1819 if cd != C_NULL
19- ccall ((:iconv_close , libiconv_path ), Cint, (Ptr{Void},), cd) == 0 ||
20+ ccall ((:iconv_close , libiconv ), Cint, (Ptr{Void},), cd) == 0 ||
2021 error (" failed to call iconv_close: error $(errno ()) ($(strerror (errno ())) )" )
2122 end
2223end
2324
2425function iconv_open (tocode, fromcode)
25- p = ccall ((:iconv_open , libiconv_path ), Ptr{Void}, (Cstring, Cstring), tocode, fromcode)
26+ p = ccall ((:iconv_open , libiconv ), Ptr{Void}, (Cstring, Cstring), tocode, fromcode)
2627 if p != Ptr {Void} (- 1 )
2728 return p
2829 elseif errno () == EINVAL
@@ -69,7 +70,7 @@ function iconv!(cd::Ptr{Void}, inbuf::Vector{UInt8}, outbuf::Vector{UInt8},
6970 inbytesleft_orig = inbytesleft[]
7071 outbytesleft[] = BUFSIZE
7172
72- ret = ccall ((:iconv , libiconv_path ), Csize_t,
73+ ret = ccall ((:iconv , libiconv ), Csize_t,
7374 (Ptr{Void}, Ptr{Ptr{UInt8}}, Ref{Csize_t}, Ptr{Ptr{UInt8}}, Ref{Csize_t}),
7475 cd, inbufptr, inbytesleft, outbufptr, outbytesleft)
7576
@@ -101,7 +102,7 @@ function iconv_reset!(s::Union{StringEncoder, StringDecoder})
101102
102103 s. outbufptr[] = pointer (s. outbuf)
103104 s. outbytesleft[] = BUFSIZE
104- ret = ccall ((:iconv , libiconv_path ), Csize_t,
105+ ret = ccall ((:iconv , libiconv ), Csize_t,
105106 (Ptr{Void}, Ptr{Ptr{UInt8}}, Ref{Csize_t}, Ptr{Ptr{UInt8}}, Ref{Csize_t}),
106107 s. cd, C_NULL , C_NULL , s. outbufptr, s. outbytesleft)
107108
0 commit comments