From 08a4440d643fb6f7db90f67b40f9f29c6bdf5228 Mon Sep 17 00:00:00 2001 From: Michael Sullivan Date: Sat, 14 Jul 2012 10:05:49 -0700 Subject: [PATCH] Fix a bunch of deprecated str/vec errors in code for non 64-bit linux platforms... --- src/libcore/os.rs | 44 +++++++++++++++++----------------- src/libcore/path.rs | 2 +- src/libcore/run.rs | 2 +- src/rustc/middle/trans/base.rs | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 24988870c0d..92327829247 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -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 { + -> 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::from_utf16(sub)); + res = option::some(str::from_utf16(sub)); done = true; } } @@ -113,7 +113,7 @@ mod win32 { ret res; } - fn as_utf16_p(s: str, f: fn(*u16) -> T) -> T { + fn as_utf16_p(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 { + 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 { #[cfg(windows)] fn secondary() -> option { - 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 { diff --git a/src/libcore/path.rs b/src/libcore/path.rs index 35fc7510757..07549acd5bc 100644 --- a/src/libcore/path.rs +++ b/src/libcore/path.rs @@ -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 diff --git a/src/libcore/run.rs b/src/libcore/run.rs index c8e55bea2a5..a466971b9bd 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -118,7 +118,7 @@ fn with_envp(env: option<~[(~str,~str)]>, } #[cfg(windows)] -fn with_envp(env: option<~[(str,str)]>, +fn with_envp(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 diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 9273170c65c..066b4cc57e6 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -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);