@@ -7,7 +7,7 @@ Basic input/output
7
7
import result:: result;
8
8
9
9
import dvec :: { dvec, extensions} ;
10
- import libc :: { c_int, c_uint, c_void, size_t, ssize_t} ;
10
+ import libc :: { c_int, c_long , c_uint, c_void, size_t, ssize_t} ;
11
11
import libc:: consts:: os:: posix88:: * ;
12
12
import libc:: consts:: os:: extra:: * ;
13
13
@@ -196,17 +196,17 @@ impl of reader for *libc::FILE {
196
196
let mut buf : [ mut u8] = [ mut] ;
197
197
vec:: reserve ( buf, len) ;
198
198
vec:: as_mut_buf ( buf) { |b|
199
- let read = libc:: fread ( b as * mut c_void , 1 u,
200
- len, self ) ;
201
- vec:: unsafe:: set_len ( buf, read) ;
199
+ let read = libc:: fread ( b as * mut c_void , 1 u as size_t ,
200
+ len as size_t , self ) ;
201
+ vec:: unsafe:: set_len ( buf, read as uint ) ;
202
202
}
203
203
ret vec:: from_mut( buf) ;
204
204
}
205
205
fn read_byte ( ) -> int { ret libc:: fgetc ( self ) as int ; }
206
206
fn unread_byte ( byte : int ) { libc:: ungetc ( byte as c_int , self ) ; }
207
207
fn eof ( ) -> bool { ret libc:: feof ( self ) != 0 as c_int ; }
208
208
fn seek ( offset : int , whence : seek_style ) {
209
- assert libc:: fseek ( self , offset, convert_whence ( whence) )
209
+ assert libc:: fseek ( self , offset as c_long , convert_whence ( whence) )
210
210
== 0 as c_int ;
211
211
}
212
212
fn tell ( ) -> uint { ret libc:: ftell ( self ) as uint ; }
@@ -332,7 +332,8 @@ impl <T: writer, C> of writer for {base: T, cleanup: C} {
332
332
impl of writer for * libc:: FILE {
333
333
fn write ( v : [ const u8 ] /& ) unsafe {
334
334
vec:: unpack_const_slice ( v) { |vbuf, len|
335
- let nout = libc:: fwrite ( vbuf as * c_void , len, 1 u, self ) ;
335
+ let nout = libc:: fwrite ( vbuf as * c_void , len as size_t ,
336
+ 1 u as size_t , self ) ;
336
337
if nout < 1 as size_t {
337
338
#error ( "error writing buffer" ) ;
338
339
log ( error, os:: last_os_error ( ) ) ;
@@ -341,7 +342,7 @@ impl of writer for *libc::FILE {
341
342
}
342
343
}
343
344
fn seek ( offset : int , whence : seek_style ) {
344
- assert libc:: fseek ( self , offset, convert_whence ( whence) )
345
+ assert libc:: fseek ( self , offset as c_long , convert_whence ( whence) )
345
346
== 0 as c_int ;
346
347
}
347
348
fn tell ( ) -> uint { libc:: ftell ( self ) as uint }
@@ -362,7 +363,7 @@ impl of writer for fd_t {
362
363
vec:: unpack_const_slice ( v) { |vbuf, len|
363
364
while count < len {
364
365
let vb = ptr:: const_offset ( vbuf, count) as * c_void ;
365
- let nout = libc:: write ( self , vb, len) ;
366
+ let nout = libc:: write ( self , vb, len as size_t ) ;
366
367
if nout < 0 as ssize_t {
367
368
#error ( "error writing buffer" ) ;
368
369
log ( error, os:: last_os_error ( ) ) ;
0 commit comments