Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
225de0d6
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
225de0d6
编写于
11月 18, 2014
作者:
N
Nick Cameron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Windows and OS X fallout
上级
d46f7adb
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
22 addition
and
22 deletion
+22
-22
src/libstd/os.rs
src/libstd/os.rs
+5
-5
src/libstd/rand/os.rs
src/libstd/rand/os.rs
+2
-2
src/libstd/rt/backtrace.rs
src/libstd/rt/backtrace.rs
+1
-1
src/libstd/sys/windows/fs.rs
src/libstd/sys/windows/fs.rs
+1
-1
src/libstd/sys/windows/os.rs
src/libstd/sys/windows/os.rs
+1
-1
src/libstd/sys/windows/pipe.rs
src/libstd/sys/windows/pipe.rs
+4
-4
src/libstd/sys/windows/process.rs
src/libstd/sys/windows/process.rs
+5
-5
src/test/run-pass/tcp-stress.rs
src/test/run-pass/tcp-stress.rs
+3
-3
未找到文件。
src/libstd/os.rs
浏览文件 @
225de0d6
...
...
@@ -140,7 +140,7 @@ pub fn getcwd() -> Path {
panic!
();
}
}
Path
::
new
(
String
::
from_utf16
(::
str
::
truncate_utf16_at_nul
(
buf
))
Path
::
new
(
String
::
from_utf16
(::
str
::
truncate_utf16_at_nul
(
&
buf
))
.expect
(
"GetCurrentDirectoryW returned invalid UTF-16"
))
}
...
...
@@ -2065,12 +2065,12 @@ fn test_eq(input: &[&str], output: &str) -> bool {
join_paths
(
input
)
.unwrap
()
.as_slice
()
==
output
.as_bytes
()
}
assert
!
(
test_eq
([],
""
));
assert
!
(
test_eq
([
r"c:\windows"
,
r"c:\"
],
assert
!
(
test_eq
(
&
[],
""
));
assert
!
(
test_eq
(
&
[
r"c:\windows"
,
r"c:\"
],
r"c:\windows;c:\"
));
assert
!
(
test_eq
([
""
,
r"c:\windows"
,
""
,
""
,
r"c:\"
,
""
],
assert
!
(
test_eq
(
&
[
""
,
r"c:\windows"
,
""
,
""
,
r"c:\"
,
""
],
r";c:\windows;;;c:\;"
));
assert
!
(
test_eq
([
r"c:\te;st"
,
r"c:\"
],
assert
!
(
test_eq
(
&
[
r"c:\te;st"
,
r"c:\"
],
r#""c:\te;st";c:\"#
));
assert
!
(
join_paths
(
&
[
r#"c:\te"st"#
])
.is_err
());
}
...
...
src/libstd/rand/os.rs
浏览文件 @
225de0d6
...
...
@@ -298,12 +298,12 @@ pub fn new() -> IoResult<OsRng> {
impl
Rng
for
OsRng
{
fn
next_u32
(
&
mut
self
)
->
u32
{
let
mut
v
=
[
0u8
,
..
4
];
self
.fill_bytes
(
v
);
self
.fill_bytes
(
&
mut
v
);
unsafe
{
mem
::
transmute
(
v
)
}
}
fn
next_u64
(
&
mut
self
)
->
u64
{
let
mut
v
=
[
0u8
,
..
8
];
self
.fill_bytes
(
v
);
self
.fill_bytes
(
&
mut
v
);
unsafe
{
mem
::
transmute
(
v
)
}
}
fn
fill_bytes
(
&
mut
self
,
v
:
&
mut
[
u8
])
{
...
...
src/libstd/rt/backtrace.rs
浏览文件 @
225de0d6
...
...
@@ -999,7 +999,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
None
=>
try!
(
w
.write
(
bytes
[
..
bytes
.len
()
-
1
])),
}
}
try!
(
w
.write
([
'\n'
as
u8
]));
try!
(
w
.write
(
&
[
'\n'
as
u8
]));
}
Ok
(())
...
...
src/libstd/sys/windows/fs.rs
浏览文件 @
225de0d6
...
...
@@ -263,7 +263,7 @@ fn prune(root: &Path, dirs: Vec<Path>) -> Vec<Path> {
let
mut
more_files
=
1
as
libc
::
BOOL
;
while
more_files
!=
0
{
{
let
filename
=
str
::
truncate_utf16_at_nul
(
wfd
.cFileName
);
let
filename
=
str
::
truncate_utf16_at_nul
(
&
wfd
.cFileName
);
match
String
::
from_utf16
(
filename
)
{
Some
(
filename
)
=>
paths
.push
(
Path
::
new
(
filename
)),
None
=>
{
...
...
src/libstd/sys/windows/os.rs
浏览文件 @
225de0d6
...
...
@@ -76,7 +76,7 @@ fn FormatMessageW(flags: DWORD,
return
format!
(
"OS Error {} (FormatMessageW() returned error {})"
,
errnum
,
fm_err
);
}
let
msg
=
String
::
from_utf16
(::
str
::
truncate_utf16_at_nul
(
buf
));
let
msg
=
String
::
from_utf16
(::
str
::
truncate_utf16_at_nul
(
&
buf
));
match
msg
{
Some
(
msg
)
=>
format!
(
"OS Error {}: {}"
,
errnum
,
msg
),
None
=>
format!
(
"OS Error {} (FormatMessageW() returned invalid UTF-16)"
,
errnum
),
...
...
src/libstd/sys/windows/pipe.rs
浏览文件 @
225de0d6
...
...
@@ -395,7 +395,7 @@ pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
loop
{
// Process a timeout if one is pending
let
wait_succeeded
=
await
(
self
.handle
(),
self
.read_deadline
,
[
overlapped
.hEvent
]);
&
[
overlapped
.hEvent
]);
let
ret
=
unsafe
{
libc
::
GetOverlappedResult
(
self
.handle
(),
...
...
@@ -459,7 +459,7 @@ pub fn write(&mut self, buf: &[u8]) -> IoResult<()> {
}
// Process a timeout if one is pending
let
wait_succeeded
=
await
(
self
.handle
(),
self
.write_deadline
,
[
overlapped
.hEvent
]);
&
[
overlapped
.hEvent
]);
let
ret
=
unsafe
{
libc
::
GetOverlappedResult
(
self
.handle
(),
&
mut
overlapped
,
...
...
@@ -660,8 +660,8 @@ pub fn accept(&mut self) -> IoResult<UnixStream> {
if
err
==
libc
::
ERROR_IO_PENDING
as
libc
::
DWORD
{
// Process a timeout if one is pending
let
wait_succeeded
=
await
(
handle
,
self
.deadline
,
[
self
.inner.abort
.handle
(),
overlapped
.hEvent
]);
&
[
self
.inner.abort
.handle
(),
overlapped
.hEvent
]);
// This will block until the overlapped I/O is completed. The
// timeout was previously handled, so this will either block in
...
...
src/libstd/sys/windows/process.rs
浏览文件 @
225de0d6
...
...
@@ -487,24 +487,24 @@ fn test_wrapper(prog: &str, args: &[&str]) -> String {
}
assert_eq!
(
test_wrapper
(
"prog"
,
[
"aaa"
,
"bbb"
,
"ccc"
]),
test_wrapper
(
"prog"
,
&
[
"aaa"
,
"bbb"
,
"ccc"
]),
"prog aaa bbb ccc"
.to_string
()
);
assert_eq!
(
test_wrapper
(
"C:
\\
Program Files
\\
blah
\\
blah.exe"
,
[
"aaa"
]),
test_wrapper
(
"C:
\\
Program Files
\\
blah
\\
blah.exe"
,
&
[
"aaa"
]),
"
\"
C:
\\
Program Files
\\
blah
\\
blah.exe
\"
aaa"
.to_string
()
);
assert_eq!
(
test_wrapper
(
"C:
\\
Program Files
\\
test"
,
[
"aa
\"
bb"
]),
test_wrapper
(
"C:
\\
Program Files
\\
test"
,
&
[
"aa
\"
bb"
]),
"
\"
C:
\\
Program Files
\\
test
\"
aa
\\\"
bb"
.to_string
()
);
assert_eq!
(
test_wrapper
(
"echo"
,
[
"a b c"
]),
test_wrapper
(
"echo"
,
&
[
"a b c"
]),
"echo
\"
a b c
\"
"
.to_string
()
);
assert_eq!
(
test_wrapper
(
"
\u03c0\u042f\u97f3\u00e6\u221e
"
,
[]),
test_wrapper
(
"
\u03c0\u042f\u97f3\u00e6\u221e
"
,
&
[]),
"
\u03c0\u042f\u97f3\u00e6\u221e
"
.to_string
()
);
}
...
...
src/test/run-pass/tcp-stress.rs
浏览文件 @
225de0d6
...
...
@@ -45,7 +45,7 @@ fn main() {
}
};
stream
.read_byte
();
stream
.write
([
2
]);
stream
.write
(
&
[
2
]);
}
});
let
addr
=
rx
.recv
();
...
...
@@ -57,9 +57,9 @@ fn main() {
match
TcpStream
::
connect
(
addr
)
{
Ok
(
stream
)
=>
{
let
mut
stream
=
stream
;
stream
.write
([
1
]);
stream
.write
(
&
[
1
]);
let
mut
buf
=
[
0
];
stream
.read
(
buf
);
stream
.read
(
&
mut
buf
);
},
Err
(
e
)
=>
debug!
(
"{}"
,
e
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录