about summary refs log tree commit diff
path: root/src/libstd/rt/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/rt/io')
-rw-r--r--src/libstd/rt/io/native/file.rs18
-rw-r--r--src/libstd/rt/io/net/addrinfo.rs7
2 files changed, 20 insertions, 5 deletions
diff --git a/src/libstd/rt/io/native/file.rs b/src/libstd/rt/io/native/file.rs
index a2b2289679a..ba819df071a 100644
--- a/src/libstd/rt/io/native/file.rs
+++ b/src/libstd/rt/io/native/file.rs
@@ -17,9 +17,18 @@ use os;
 use prelude::*;
 use super::super::*;
 
-fn raise_error() {
+#[cfg(windows)]
+fn get_err(errno: i32) -> (IoErrorKind, &'static str) {
+    match errno {
+        libc::EOF => (EndOfFile, "end of file"),
+        _ => (OtherIoError, "unknown error"),
+    }
+}
+
+#[cfg(not(windows))]
+fn get_err(errno: i32) -> (IoErrorKind, &'static str) {
     // XXX: this should probably be a bit more descriptive...
-    let (kind, desc) = match os::errno() as i32 {
+    match errno {
         libc::EOF => (EndOfFile, "end of file"),
 
         // These two constants can have the same value on some systems, but
@@ -28,8 +37,11 @@ fn raise_error() {
             (ResourceUnavailable, "resource temporarily unavailable"),
 
         _ => (OtherIoError, "unknown error"),
-    };
+    }
+}
 
+fn raise_error() {
+    let (kind, desc) = get_err(os::errno() as i32);
     io_error::cond.raise(IoError {
         kind: kind,
         desc: desc,
diff --git a/src/libstd/rt/io/net/addrinfo.rs b/src/libstd/rt/io/net/addrinfo.rs
index e0c92730cd9..27cf9781c9c 100644
--- a/src/libstd/rt/io/net/addrinfo.rs
+++ b/src/libstd/rt/io/net/addrinfo.rs
@@ -91,8 +91,11 @@ pub fn get_host_addresses(host: &str) -> Option<~[IpAddr]> {
 /// # Failure
 ///
 /// On failure, this will raise on the `io_error` condition.
-pub fn lookup(hostname: Option<&str>, servname: Option<&str>,
-              hint: Option<Hint>) -> Option<~[Info]> {
+///
+/// XXX: this is not public because the `Hint` structure is not ready for public
+///      consumption just yet.
+fn lookup(hostname: Option<&str>, servname: Option<&str>,
+          hint: Option<Hint>) -> Option<~[Info]> {
     do with_local_io |io| {
         match io.get_host_addresses(hostname, servname, hint) {
             Ok(i) => Some(i),