Skip to content

Commit b5cec72

Browse files
committed
---
yaml --- r: 145146 b: refs/heads/try2 c: f3c8882 h: refs/heads/master v: v3
1 parent 812417b commit b5cec72

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 1e745f16790f22fc10652a6ffae36bf5572255bb
8+
refs/heads/try2: f3c88825337c295850de546bd3d8745c8cad1224
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/os.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,18 +1135,19 @@ pub fn last_os_error() -> ~str {
11351135
#[fixed_stack_segment]; #[inline(never)];
11361136

11371137
use libc::types::os::arch::extra::DWORD;
1138-
use libc::types::os::arch::extra::LPSTR;
1138+
use libc::types::os::arch::extra::LPWSTR;
11391139
use libc::types::os::arch::extra::LPVOID;
1140+
use libc::types::os::arch::extra::WCHAR;
11401141

11411142
#[cfg(target_arch = "x86")]
11421143
#[link_name = "kernel32"]
11431144
#[abi = "stdcall"]
11441145
extern "stdcall" {
1145-
fn FormatMessageA(flags: DWORD,
1146+
fn FormatMessageW(flags: DWORD,
11461147
lpSrc: LPVOID,
11471148
msgId: DWORD,
11481149
langId: DWORD,
1149-
buf: LPSTR,
1150+
buf: LPWSTR,
11501151
nsize: DWORD,
11511152
args: *c_void)
11521153
-> DWORD;
@@ -1155,11 +1156,11 @@ pub fn last_os_error() -> ~str {
11551156
#[cfg(target_arch = "x86_64")]
11561157
#[link_name = "kernel32"]
11571158
extern {
1158-
fn FormatMessageA(flags: DWORD,
1159+
fn FormatMessageW(flags: DWORD,
11591160
lpSrc: LPVOID,
11601161
msgId: DWORD,
11611162
langId: DWORD,
1162-
buf: LPSTR,
1163+
buf: LPWSTR,
11631164
nsize: DWORD,
11641165
args: *c_void)
11651166
-> DWORD;
@@ -1173,11 +1174,11 @@ pub fn last_os_error() -> ~str {
11731174
let langId = 0x0800 as DWORD;
11741175
let err = errno() as DWORD;
11751176

1176-
let mut buf = [0 as c_char, ..TMPBUF_SZ];
1177+
let mut buf = [0 as WCHAR, ..TMPBUF_SZ];
11771178

11781179
unsafe {
11791180
do buf.as_mut_buf |buf, len| {
1180-
let res = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
1181+
let res = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
11811182
FORMAT_MESSAGE_IGNORE_INSERTS,
11821183
ptr::mut_null(),
11831184
err,
@@ -1190,9 +1191,7 @@ pub fn last_os_error() -> ~str {
11901191
}
11911192
}
11921193

1193-
do buf.as_imm_buf |buf, _len| {
1194-
str::raw::from_c_str(buf)
1195-
}
1194+
str::from_utf16(buf)
11961195
}
11971196
}
11981197

0 commit comments

Comments
 (0)