22
33# # IOStream
44
5- const sizeof_ios_t = Int (ccall (:jl_sizeof_ios_t , Int32 , ()))
5+ const sizeof_ios_t = Int (ccall (:jl_sizeof_ios_t , Cint , ()))
66
77type IOStream <: IO
88 handle:: Ptr{Void}
@@ -41,7 +41,7 @@ iswritable(s::IOStream) = ccall(:ios_get_writable, Cint, (Ptr{Void},), s.ios)!=0
4141isreadable (s:: IOStream ) = ccall (:ios_get_readable , Cint, (Ptr{Void},), s. ios)!= 0
4242
4343function truncate (s:: IOStream , n:: Integer )
44- systemerror (" truncate" , ccall (:ios_trunc , Int32 , (Ptr{Void}, UInt ), s. ios, n) != 0 )
44+ systemerror (" truncate" , ccall (:ios_trunc , Cint , (Ptr{Void}, Csize_t ), s. ios, n) != 0 )
4545 return s
4646end
4747
@@ -72,14 +72,14 @@ function position(s::IOStream)
7272 return pos
7373end
7474
75- eof (s:: IOStream ) = ccall (:ios_eof_blocking , Int32 , (Ptr{Void},), s. ios)!= 0
75+ eof (s:: IOStream ) = ccall (:ios_eof_blocking , Cint , (Ptr{Void},), s. ios)!= 0
7676
7777# # constructing and opening streams ##
7878
7979# "own" means the descriptor will be closed with the IOStream
8080function fdio (name:: AbstractString , fd:: Integer , own:: Bool = false )
8181 s = IOStream (name)
82- ccall (:ios_fd , Ptr{Void}, (Ptr{Void}, Clong, Int32, Int32 ),
82+ ccall (:ios_fd , Ptr{Void}, (Ptr{Void}, Clong, Cint, Cint ),
8383 s. ios, fd, 0 , own);
8484 return s
8585end
@@ -89,7 +89,7 @@ function open(fname::AbstractString, rd::Bool, wr::Bool, cr::Bool, tr::Bool, ff:
8989 s = IOStream (string (" <file " ,fname," >" ))
9090 systemerror (" opening file $fname " ,
9191 ccall (:ios_file , Ptr{Void},
92- (Ptr{UInt8}, Cstring, Int32, Int32, Int32, Int32 ),
92+ (Ptr{UInt8}, Cstring, Cint, Cint, Cint, Cint ),
9393 s. ios, fname, rd, wr, cr, tr) == C_NULL )
9494 if ff
9595 systemerror (" seeking to end of file $fname " , ccall (:ios_seek_end , FileOffset, (Ptr{Void},), s. ios) != 0 )
@@ -119,14 +119,14 @@ end
119119
120120# # low-level calls ##
121121
122- write (s:: IOStream , b:: UInt8 ) = Int (ccall (:ios_putc , Int32 , (UInt8 , Ptr{Void}), b, s. ios))
122+ write (s:: IOStream , b:: UInt8 ) = Int (ccall (:ios_putc , Cint , (Cint , Ptr{Void}), b, s. ios))
123123
124124function write {T} (s:: IOStream , a:: Array{T} )
125125 if isbits (T)
126126 if ! iswritable (s)
127127 throw (ArgumentError (" write failed, IOStream is not writeable" ))
128128 end
129- Int (ccall (:ios_write , UInt , (Ptr{Void}, Ptr{Void}, UInt ),
129+ Int (ccall (:ios_write , Csize_t , (Ptr{Void}, Ptr{Void}, Csize_t ),
130130 s. ios, a, length (a)* sizeof (T)))
131131 else
132132 invoke (write, Tuple{IO, Array}, s, a)
@@ -137,7 +137,7 @@ function write(s::IOStream, p::Ptr, nb::Integer)
137137 if ! iswritable (s)
138138 throw (ArgumentError (" write failed, IOStream is not writeable" ))
139139 end
140- Int (ccall (:ios_write , UInt , (Ptr{Void}, Ptr{Void}, UInt ), s. ios, p, nb))
140+ Int (ccall (:ios_write , Csize_t , (Ptr{Void}, Ptr{Void}, Csize_t ), s. ios, p, nb))
141141end
142142
143143function write {T,N,A<:Array} (s:: IOStream , a:: SubArray{T,N,A} )
159159nb_available (s:: IOStream ) = ccall (:jl_nb_available , Int32, (Ptr{Void},), s. ios)
160160
161161function read (s:: IOStream , :: Type{UInt8} )
162- b = ccall (:ios_getc , Int32 , (Ptr{Void},), s. ios)
162+ b = ccall (:ios_getc , Cint , (Ptr{Void},), s. ios)
163163 if b == - 1
164164 throw (EOFError ())
165165 end
@@ -171,8 +171,8 @@ function read{T<:Union{UInt16, Int16, UInt32, Int32, UInt64, Int64}}(s::IOStream
171171end
172172
173173function read! (s:: IOStream , a:: Vector{UInt8} )
174- if ccall (:ios_readall , UInt ,
175- (Ptr{Void}, Ptr{Void}, UInt ), s. ios, a, sizeof (a)) < sizeof (a)
174+ if ccall (:ios_readall , Csize_t ,
175+ (Ptr{Void}, Ptr{Void}, Csize_t ), s. ios, a, sizeof (a)) < sizeof (a)
176176 throw (EOFError ())
177177 end
178178 a
@@ -184,7 +184,7 @@ function write(s::IOStream, c::Char)
184184 if ! iswritable (s)
185185 throw (ArgumentError (" write failed, IOStream is not writeable" ))
186186 end
187- Int (ccall (:ios_pututf8 , Int32 , (Ptr{Void}, UInt32), s. ios, c))
187+ Int (ccall (:ios_pututf8 , Cint , (Ptr{Void}, UInt32), s. ios, c))
188188end
189189read (s:: IOStream , :: Type{Char} ) = Char (ccall (:jl_getutf8 , UInt32, (Ptr{Void},), s. ios))
190190
@@ -223,7 +223,7 @@ function readbytes_all!(s::IOStream, b::Array{UInt8}, nb)
223223 lb = max (65536 , (nr+ 1 ) * 2 )
224224 resize! (b, lb)
225225 end
226- nr += Int (ccall (:ios_readall , UInt , (Ptr{Void}, Ptr{Void}, UInt ),
226+ nr += Int (ccall (:ios_readall , Csize_t , (Ptr{Void}, Ptr{Void}, Csize_t ),
227227 s. ios, pointer (b, nr+ 1 ), min (lb- nr, nb- nr)))
228228 eof (s) && break
229229 end
@@ -238,7 +238,7 @@ function readbytes_some!(s::IOStream, b::Array{UInt8}, nb)
238238 if nb > lb
239239 resize! (b, nb)
240240 end
241- nr = Int (ccall (:ios_read , UInt , (Ptr{Void}, Ptr{Void}, UInt ),
241+ nr = Int (ccall (:ios_read , Csize_t , (Ptr{Void}, Ptr{Void}, Csize_t ),
242242 s. ios, pointer (b), nb))
243243 if lb > olb && lb > nr
244244 resize! (b, nr)
@@ -273,14 +273,14 @@ end
273273# # Character streams ##
274274const _chtmp = Array (Char, 1 )
275275function peekchar (s:: IOStream )
276- if ccall (:ios_peekutf8 , Int32 , (Ptr{Void}, Ptr{Char}), s, _chtmp) < 0
276+ if ccall (:ios_peekutf8 , Cint , (Ptr{Void}, Ptr{Char}), s, _chtmp) < 0
277277 return Char (- 1 )
278278 end
279279 return _chtmp[1 ]
280280end
281281
282282function peek (s:: IOStream )
283- ccall (:ios_peekc , Int32 , (Ptr{Void},), s)
283+ ccall (:ios_peekc , Cint , (Ptr{Void},), s)
284284end
285285
286286function skipchars (s:: IOStream , pred; linecomment:: Char = Char (0xffffffff ))
0 commit comments