From dde41869ce2ef1d66e753fc8b4efc7d917c77875 Mon Sep 17 00:00:00 2001 From: Haitao Li Date: Mon, 16 Jan 2012 18:21:01 +0800 Subject: Use ctypes in native function declarations --- src/libstd/dbg.rs | 3 ++- src/libstd/fs.rs | 8 ++++---- src/libstd/test.rs | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/dbg.rs b/src/libstd/dbg.rs index ea98150d76a..e1f82fedda0 100644 --- a/src/libstd/dbg.rs +++ b/src/libstd/dbg.rs @@ -14,7 +14,8 @@ native mod rustrt { fn debug_opaque(td: *sys::type_desc, x: T); fn debug_box(td: *sys::type_desc, x: @T); fn debug_tag(td: *sys::type_desc, x: T); - fn debug_obj(td: *sys::type_desc, x: T, nmethods: uint, nbytes: uint); + fn debug_obj(td: *sys::type_desc, x: T, + nmethods: ctypes::size_t, nbytes: ctypes::size_t); fn debug_fn(td: *sys::type_desc, x: T); fn debug_ptrcast(td: *sys::type_desc, x: @T) -> @U; } diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 5a4bcbde101..fe06e2a89aa 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -13,8 +13,8 @@ import os_fs; #[abi = "cdecl"] native mod rustrt { - fn rust_path_is_dir(path: str::sbuf) -> int; - fn rust_path_exists(path: str::sbuf) -> int; + fn rust_path_is_dir(path: str::sbuf) -> ctypes::c_int; + fn rust_path_exists(path: str::sbuf) -> ctypes::c_int; } /* @@ -120,7 +120,7 @@ Function: path_is_dir Indicates whether a path represents a directory. */ fn path_is_dir(p: path) -> bool { - ret str::as_buf(p, {|buf| rustrt::rust_path_is_dir(buf) != 0 }); + ret str::as_buf(p, {|buf| rustrt::rust_path_is_dir(buf) != 0i32 }); } /* @@ -129,7 +129,7 @@ Function: path_exists Indicates whether a path exists. */ fn path_exists(p: path) -> bool { - ret str::as_buf(p, {|buf| rustrt::rust_path_exists(buf) != 0 }); + ret str::as_buf(p, {|buf| rustrt::rust_path_exists(buf) != 0i32 }); } /* diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 7dbe8659679..3d58a71f950 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -5,6 +5,7 @@ import result::{ok, err}; import io::writer_util; +import core::ctypes; export test_name; export test_fn; @@ -28,7 +29,7 @@ export joinable; #[abi = "cdecl"] native mod rustrt { - fn sched_threads() -> uint; + fn sched_threads() -> ctypes::size_t; } // The name of a test. By convention this follows the rules for rust -- cgit 1.4.1-3-g733a5