Fix a bunch of deprecated str/vec errors in code for non 64-bit linux platforms...
This commit is contained in:
parent
5a7d139a38
commit
08a4440d64
4 changed files with 25 additions and 25 deletions
|
@ -84,7 +84,7 @@ mod win32 {
|
||||||
import dword = libc::types::os::arch::extra::DWORD;
|
import dword = libc::types::os::arch::extra::DWORD;
|
||||||
|
|
||||||
fn fill_utf16_buf_and_decode(f: fn(*mut u16, dword) -> dword)
|
fn fill_utf16_buf_and_decode(f: fn(*mut u16, dword) -> dword)
|
||||||
-> option<str> {
|
-> option<~str> {
|
||||||
|
|
||||||
// FIXME: remove these when export globs work properly. #1238
|
// FIXME: remove these when export globs work properly. #1238
|
||||||
import libc::funcs::extra::kernel32::*;
|
import libc::funcs::extra::kernel32::*;
|
||||||
|
@ -105,7 +105,7 @@ mod win32 {
|
||||||
n *= (2 as dword);
|
n *= (2 as dword);
|
||||||
} else {
|
} else {
|
||||||
let sub = vec::slice(buf, 0u, k as uint);
|
let sub = vec::slice(buf, 0u, k as uint);
|
||||||
res = option::some::<str>(str::from_utf16(sub));
|
res = option::some(str::from_utf16(sub));
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ mod win32 {
|
||||||
ret res;
|
ret res;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_utf16_p<T>(s: str, f: fn(*u16) -> T) -> T {
|
fn as_utf16_p<T>(s: ~str, f: fn(*u16) -> T) -> T {
|
||||||
let mut t = str::to_utf16(s);
|
let mut t = str::to_utf16(s);
|
||||||
// Null terminate before passing on.
|
// Null terminate before passing on.
|
||||||
t += ~[0u16];
|
t += ~[0u16];
|
||||||
|
@ -212,7 +212,7 @@ mod global_env {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn getenv(n: str) -> option<str> {
|
fn getenv(n: ~str) -> option<~str> {
|
||||||
import libc::types::os::arch::extra::*;
|
import libc::types::os::arch::extra::*;
|
||||||
import libc::funcs::extra::kernel32::*;
|
import libc::funcs::extra::kernel32::*;
|
||||||
import win32::*;
|
import win32::*;
|
||||||
|
@ -238,7 +238,7 @@ mod global_env {
|
||||||
|
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn setenv(n: str, v: str) {
|
fn setenv(n: ~str, v: ~str) {
|
||||||
// FIXME: remove imports when export globs work properly. #1238
|
// FIXME: remove imports when export globs work properly. #1238
|
||||||
import libc::funcs::extra::kernel32::*;
|
import libc::funcs::extra::kernel32::*;
|
||||||
import win32::*;
|
import win32::*;
|
||||||
|
@ -355,7 +355,7 @@ fn dll_filename(base: ~str) -> ~str {
|
||||||
fn pre() -> ~str { ~"lib" }
|
fn pre() -> ~str { ~"lib" }
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn pre() -> str { "" }
|
fn pre() -> ~str { ~"" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ fn homedir() -> option<path> {
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn secondary() -> option<path> {
|
fn secondary() -> option<path> {
|
||||||
do option::chain(getenv("USERPROFILE")) |p| {
|
do option::chain(getenv(~"USERPROFILE")) |p| {
|
||||||
if !str::is_empty(p) {
|
if !str::is_empty(p) {
|
||||||
some(p)
|
some(p)
|
||||||
} else {
|
} else {
|
||||||
|
@ -554,13 +554,13 @@ fn list_dir(p: path) -> ~[~str] {
|
||||||
fn star(p: ~str) -> ~str { p }
|
fn star(p: ~str) -> ~str { p }
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn star(p: str) -> str {
|
fn star(p: str) -> ~str {
|
||||||
let pl = str::len(p);
|
let pl = str::len(p);
|
||||||
if pl == 0u || (p[pl - 1u] as char != path::consts::path_sep
|
if pl == 0u || (p[pl - 1u] as char != path::consts::path_sep
|
||||||
|| p[pl - 1u] as char != path::consts::alt_path_sep) {
|
|| p[pl - 1u] as char != path::consts::alt_path_sep) {
|
||||||
p + path::path_sep() + "*"
|
p + path::path_sep() + ~"*"
|
||||||
} else {
|
} else {
|
||||||
p + "*"
|
p + ~"*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,20 +737,20 @@ fn set_exit_status(code: int) {
|
||||||
fn family() -> ~str { ~"unix" }
|
fn family() -> ~str { ~"unix" }
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn family() -> str { "windows" }
|
fn family() -> ~str { ~"windows" }
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
mod consts {
|
mod consts {
|
||||||
fn sysname() -> str { "macos" }
|
fn sysname() -> ~str { ~"macos" }
|
||||||
fn exe_suffix() -> str { "" }
|
fn exe_suffix() -> ~str { ~"" }
|
||||||
fn dll_suffix() -> str { ".dylib" }
|
fn dll_suffix() -> ~str { ~".dylib" }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "freebsd")]
|
#[cfg(target_os = "freebsd")]
|
||||||
mod consts {
|
mod consts {
|
||||||
fn sysname() -> str { "freebsd" }
|
fn sysname() -> ~str { ~"freebsd" }
|
||||||
fn exe_suffix() -> str { "" }
|
fn exe_suffix() -> ~str { ~"" }
|
||||||
fn dll_suffix() -> str { ".so" }
|
fn dll_suffix() -> ~str { ~".so" }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
|
@ -762,19 +762,19 @@ mod consts {
|
||||||
|
|
||||||
#[cfg(target_os = "win32")]
|
#[cfg(target_os = "win32")]
|
||||||
mod consts {
|
mod consts {
|
||||||
fn sysname() -> str { "win32" }
|
fn sysname() -> ~str { ~"win32" }
|
||||||
fn exe_suffix() -> str { ".exe" }
|
fn exe_suffix() -> ~str { ~".exe" }
|
||||||
fn dll_suffix() -> str { ".dll" }
|
fn dll_suffix() -> ~str { ~".dll" }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_arch = "x86")]
|
#[cfg(target_arch = "x86")]
|
||||||
fn arch() -> str { "x86" }
|
fn arch() -> ~str { ~"x86" }
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
fn arch() -> ~str { ~"x86_64" }
|
fn arch() -> ~str { ~"x86_64" }
|
||||||
|
|
||||||
#[cfg(target_arch = "arm")]
|
#[cfg(target_arch = "arm")]
|
||||||
fn arch() -> str { "arm" }
|
fn arch() -> str { ~"arm" }
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
|
@ -50,7 +50,7 @@ fn path_is_absolute(p: path) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn path_is_absolute(p: str) -> bool {
|
fn path_is_absolute(p: ~str) -> bool {
|
||||||
ret str::char_at(p, 0u) == '/' ||
|
ret str::char_at(p, 0u) == '/' ||
|
||||||
str::char_at(p, 1u) == ':'
|
str::char_at(p, 1u) == ':'
|
||||||
&& (str::char_at(p, 2u) == consts::path_sep
|
&& (str::char_at(p, 2u) == consts::path_sep
|
||||||
|
|
|
@ -118,7 +118,7 @@ fn with_envp<T>(env: option<~[(~str,~str)]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn with_envp<T>(env: option<~[(str,str)]>,
|
fn with_envp<T>(env: option<~[(~str,~str)]>,
|
||||||
cb: fn(*c_void) -> T) -> T {
|
cb: fn(*c_void) -> T) -> T {
|
||||||
// On win32 we pass an "environment block" which is not a char**, but
|
// On win32 we pass an "environment block" which is not a char**, but
|
||||||
// rather a concatenation of null-terminated k=v\0 sequences, with a final
|
// rather a concatenation of null-terminated k=v\0 sequences, with a final
|
||||||
|
|
|
@ -5027,7 +5027,7 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
|
||||||
|
|
||||||
fn create_entry_fn(ccx: @crate_ctxt, rust_main: ValueRef) {
|
fn create_entry_fn(ccx: @crate_ctxt, rust_main: ValueRef) {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn main_name() -> str { ret "WinMain@16"; }
|
fn main_name() -> ~str { ret ~"WinMain@16"; }
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn main_name() -> ~str { ret ~"main"; }
|
fn main_name() -> ~str { ret ~"main"; }
|
||||||
let llfty = T_fn(~[ccx.int_type, ccx.int_type], ccx.int_type);
|
let llfty = T_fn(~[ccx.int_type, ccx.int_type], ccx.int_type);
|
||||||
|
|
Loading…
Reference in a new issue