Fix a bunch of deprecated str/vec errors in code for non 64-bit linux platforms...

This commit is contained in:
Michael Sullivan 2012-07-14 10:05:49 -07:00
parent 5a7d139a38
commit 08a4440d64
4 changed files with 25 additions and 25 deletions

View file

@ -84,7 +84,7 @@ mod win32 {
import dword = libc::types::os::arch::extra::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
import libc::funcs::extra::kernel32::*;
@ -105,7 +105,7 @@ mod win32 {
n *= (2 as dword);
} else {
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;
}
}
@ -113,7 +113,7 @@ mod win32 {
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);
// Null terminate before passing on.
t += ~[0u16];
@ -212,7 +212,7 @@ mod global_env {
}
#[cfg(windows)]
fn getenv(n: str) -> option<str> {
fn getenv(n: ~str) -> option<~str> {
import libc::types::os::arch::extra::*;
import libc::funcs::extra::kernel32::*;
import win32::*;
@ -238,7 +238,7 @@ mod global_env {
#[cfg(windows)]
fn setenv(n: str, v: str) {
fn setenv(n: ~str, v: ~str) {
// FIXME: remove imports when export globs work properly. #1238
import libc::funcs::extra::kernel32::*;
import win32::*;
@ -355,7 +355,7 @@ fn dll_filename(base: ~str) -> ~str {
fn pre() -> ~str { ~"lib" }
#[cfg(windows)]
fn pre() -> str { "" }
fn pre() -> ~str { ~"" }
}
@ -448,7 +448,7 @@ fn homedir() -> option<path> {
#[cfg(windows)]
fn secondary() -> option<path> {
do option::chain(getenv("USERPROFILE")) |p| {
do option::chain(getenv(~"USERPROFILE")) |p| {
if !str::is_empty(p) {
some(p)
} else {
@ -554,13 +554,13 @@ fn list_dir(p: path) -> ~[~str] {
fn star(p: ~str) -> ~str { p }
#[cfg(windows)]
fn star(p: str) -> str {
fn star(p: str) -> ~str {
let pl = str::len(p);
if pl == 0u || (p[pl - 1u] as char != path::consts::path_sep
|| p[pl - 1u] as char != path::consts::alt_path_sep) {
p + path::path_sep() + "*"
p + path::path_sep() + ~"*"
} else {
p + "*"
p + ~"*"
}
}
@ -737,20 +737,20 @@ fn set_exit_status(code: int) {
fn family() -> ~str { ~"unix" }
#[cfg(windows)]
fn family() -> str { "windows" }
fn family() -> ~str { ~"windows" }
#[cfg(target_os = "macos")]
mod consts {
fn sysname() -> str { "macos" }
fn exe_suffix() -> str { "" }
fn dll_suffix() -> str { ".dylib" }
fn sysname() -> ~str { ~"macos" }
fn exe_suffix() -> ~str { ~"" }
fn dll_suffix() -> ~str { ~".dylib" }
}
#[cfg(target_os = "freebsd")]
mod consts {
fn sysname() -> str { "freebsd" }
fn exe_suffix() -> str { "" }
fn dll_suffix() -> str { ".so" }
fn sysname() -> ~str { ~"freebsd" }
fn exe_suffix() -> ~str { ~"" }
fn dll_suffix() -> ~str { ~".so" }
}
#[cfg(target_os = "linux")]
@ -762,19 +762,19 @@ mod consts {
#[cfg(target_os = "win32")]
mod consts {
fn sysname() -> str { "win32" }
fn exe_suffix() -> str { ".exe" }
fn dll_suffix() -> str { ".dll" }
fn sysname() -> ~str { ~"win32" }
fn exe_suffix() -> ~str { ~".exe" }
fn dll_suffix() -> ~str { ~".dll" }
}
#[cfg(target_arch = "x86")]
fn arch() -> str { "x86" }
fn arch() -> ~str { ~"x86" }
#[cfg(target_arch = "x86_64")]
fn arch() -> ~str { ~"x86_64" }
#[cfg(target_arch = "arm")]
fn arch() -> str { "arm" }
fn arch() -> str { ~"arm" }
#[cfg(test)]
mod tests {

View file

@ -50,7 +50,7 @@ fn path_is_absolute(p: path) -> bool {
}
#[cfg(windows)]
fn path_is_absolute(p: str) -> bool {
fn path_is_absolute(p: ~str) -> bool {
ret str::char_at(p, 0u) == '/' ||
str::char_at(p, 1u) == ':'
&& (str::char_at(p, 2u) == consts::path_sep

View file

@ -118,7 +118,7 @@ fn with_envp<T>(env: option<~[(~str,~str)]>,
}
#[cfg(windows)]
fn with_envp<T>(env: option<~[(str,str)]>,
fn with_envp<T>(env: option<~[(~str,~str)]>,
cb: fn(*c_void) -> T) -> T {
// 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

View file

@ -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) {
#[cfg(windows)]
fn main_name() -> str { ret "WinMain@16"; }
fn main_name() -> ~str { ret ~"WinMain@16"; }
#[cfg(unix)]
fn main_name() -> ~str { ret ~"main"; }
let llfty = T_fn(~[ccx.int_type, ccx.int_type], ccx.int_type);