stdlib: Use c_ints instead of ints for natives
This commit is contained in:
parent
bb7750b8d0
commit
a69c5617f0
@ -121,11 +121,11 @@ Function: make_dir
|
||||
|
||||
Creates a directory at the specified path.
|
||||
*/
|
||||
fn make_dir(p: path, mode: int) -> bool {
|
||||
fn make_dir(p: path, mode: ctypes::c_int) -> bool {
|
||||
ret mkdir(p, mode);
|
||||
|
||||
#[cfg(target_os = "win32")]
|
||||
fn mkdir(_p: path, _mode: int) -> bool unsafe {
|
||||
fn mkdir(_p: path, _mode: ctypes::c_int) -> bool unsafe {
|
||||
// FIXME: turn mode into something useful?
|
||||
ret str::as_buf(_p, {|buf|
|
||||
os::kernel32::CreateDirectoryA(
|
||||
@ -135,8 +135,8 @@ fn make_dir(p: path, mode: int) -> bool {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn mkdir(_p: path, _mode: int) -> bool {
|
||||
ret str::as_buf(_p, {|buf| os::libc::mkdir(buf, _mode) == 0 });
|
||||
fn mkdir(_p: path, _mode: ctypes::c_int) -> bool {
|
||||
ret str::as_buf(_p, {|buf| os::libc::mkdir(buf, _mode) == 0i32 });
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ fn remove_dir(p: path) -> bool {
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
fn rmdir(_p: path) -> bool {
|
||||
ret str::as_buf(_p, {|buf| os::libc::rmdir(buf) == 0 });
|
||||
ret str::as_buf(_p, {|buf| os::libc::rmdir(buf) == 0i32 });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,8 @@ native mod libc {
|
||||
fn pipe(buf: *mutable fd_t) -> c_int;
|
||||
fn waitpid(pid: pid_t, &status: c_int, options: c_int) -> pid_t;
|
||||
fn readlink(path: str::sbuf, buf: str::sbuf, bufsize: size_t) -> ssize_t;
|
||||
fn mkdir(path: str::sbuf, mode: int) -> int;
|
||||
fn rmdir(path: str::sbuf) -> int;
|
||||
fn mkdir(path: str::sbuf, mode: c_int) -> c_int;
|
||||
fn rmdir(path: str::sbuf) -> c_int;
|
||||
}
|
||||
|
||||
mod libc_constants {
|
||||
|
@ -43,7 +43,7 @@ native mod libc {
|
||||
fn setenv(n: str::sbuf, v: str::sbuf, overwrite: c_int) -> c_int;
|
||||
fn unsetenv(n: str::sbuf) -> c_int;
|
||||
fn pipe(buf: *mutable c_int) -> c_int;
|
||||
fn waitpid(pid: int, &status: c_int, options: c_int) -> c_int;
|
||||
fn waitpid(pid: pid_t, &status: c_int, options: c_int) -> c_int;
|
||||
fn mkdir(s: str::sbuf, mode: c_int) -> c_int;
|
||||
fn rmdir(s: str::sbuf) -> c_int;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ fn mkdtemp(prefix: str, suffix: str) -> option::t<str> {
|
||||
let i = 0u;
|
||||
while (i < 1000u) {
|
||||
let s = prefix + r.gen_str(16u) + suffix;
|
||||
if fs::make_dir(s, 0x1c0) { // FIXME: u+rwx
|
||||
if fs::make_dir(s, 0x1c0i32) { // FIXME: u+rwx
|
||||
ret some(s);
|
||||
}
|
||||
i += 1u;
|
||||
|
Loading…
x
Reference in New Issue
Block a user