Skip to content

Commit a69c561

Browse files
committed
stdlib: Use c_ints instead of ints for natives
1 parent bb7750b commit a69c561

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/lib/fs.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ Function: make_dir
121121
122122
Creates a directory at the specified path.
123123
*/
124-
fn make_dir(p: path, mode: int) -> bool {
124+
fn make_dir(p: path, mode: ctypes::c_int) -> bool {
125125
ret mkdir(p, mode);
126126

127127
#[cfg(target_os = "win32")]
128-
fn mkdir(_p: path, _mode: int) -> bool unsafe {
128+
fn mkdir(_p: path, _mode: ctypes::c_int) -> bool unsafe {
129129
// FIXME: turn mode into something useful?
130130
ret str::as_buf(_p, {|buf|
131131
os::kernel32::CreateDirectoryA(
@@ -135,8 +135,8 @@ fn make_dir(p: path, mode: int) -> bool {
135135

136136
#[cfg(target_os = "linux")]
137137
#[cfg(target_os = "macos")]
138-
fn mkdir(_p: path, _mode: int) -> bool {
139-
ret str::as_buf(_p, {|buf| os::libc::mkdir(buf, _mode) == 0 });
138+
fn mkdir(_p: path, _mode: ctypes::c_int) -> bool {
139+
ret str::as_buf(_p, {|buf| os::libc::mkdir(buf, _mode) == 0i32 });
140140
}
141141
}
142142

@@ -174,7 +174,7 @@ fn remove_dir(p: path) -> bool {
174174
#[cfg(target_os = "linux")]
175175
#[cfg(target_os = "macos")]
176176
fn rmdir(_p: path) -> bool {
177-
ret str::as_buf(_p, {|buf| os::libc::rmdir(buf) == 0 });
177+
ret str::as_buf(_p, {|buf| os::libc::rmdir(buf) == 0i32 });
178178
}
179179
}
180180

src/lib/linux_os.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ native mod libc {
5151
fn pipe(buf: *mutable fd_t) -> c_int;
5252
fn waitpid(pid: pid_t, &status: c_int, options: c_int) -> pid_t;
5353
fn readlink(path: str::sbuf, buf: str::sbuf, bufsize: size_t) -> ssize_t;
54-
fn mkdir(path: str::sbuf, mode: int) -> int;
55-
fn rmdir(path: str::sbuf) -> int;
54+
fn mkdir(path: str::sbuf, mode: c_int) -> c_int;
55+
fn rmdir(path: str::sbuf) -> c_int;
5656
}
5757

5858
mod libc_constants {

src/lib/macos_os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ native mod libc {
4343
fn setenv(n: str::sbuf, v: str::sbuf, overwrite: c_int) -> c_int;
4444
fn unsetenv(n: str::sbuf) -> c_int;
4545
fn pipe(buf: *mutable c_int) -> c_int;
46-
fn waitpid(pid: int, &status: c_int, options: c_int) -> c_int;
46+
fn waitpid(pid: pid_t, &status: c_int, options: c_int) -> c_int;
4747
fn mkdir(s: str::sbuf, mode: c_int) -> c_int;
4848
fn rmdir(s: str::sbuf) -> c_int;
4949
}

src/lib/tempfile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn mkdtemp(prefix: str, suffix: str) -> option::t<str> {
1414
let i = 0u;
1515
while (i < 1000u) {
1616
let s = prefix + r.gen_str(16u) + suffix;
17-
if fs::make_dir(s, 0x1c0) { // FIXME: u+rwx
17+
if fs::make_dir(s, 0x1c0i32) { // FIXME: u+rwx
1818
ret some(s);
1919
}
2020
i += 1u;

0 commit comments

Comments
 (0)