From 291b6f16bb03c92fb383dfa12b8849808bace801 Mon Sep 17 00:00:00 2001 From: Tobias Bucher Date: Mon, 18 Jul 2016 14:31:26 +0200 Subject: Comment on the casts in the `seek` implementations on files --- src/libstd/sys/windows/fs.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/libstd/sys/windows') diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index 2683e57256d..4e6cef9a28d 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -324,6 +324,8 @@ impl File { pub fn seek(&self, pos: SeekFrom) -> io::Result { let (whence, pos) = match pos { + // Casting to `i64` is fine, `SetFilePointerEx` reinterprets this + // integer as `u64`. SeekFrom::Start(n) => (c::FILE_BEGIN, n as i64), SeekFrom::End(n) => (c::FILE_END, n), SeekFrom::Current(n) => (c::FILE_CURRENT, n), -- cgit 1.4.1-3-g733a5