From 688d00d23b9280d75a75c129382408a057c7109d Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 16 Jan 2012 02:22:47 +0000 Subject: * win32/win32.c (rb_chsize): no need to get the current file size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/win32.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'win32') diff --git a/win32/win32.c b/win32/win32.c index 4804359794..7cb1b31df6 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -4676,18 +4676,15 @@ rb_w32_uaccess(const char *path, int mode) static int rb_chsize(HANDLE h, off_t size) { - long upos, lpos, usize, lsize, uend, lend; - off_t end; + long upos, lpos, usize, lsize; int ret = -1; DWORD e; - if (((lpos = SetFilePointer(h, 0, (upos = 0, &upos), SEEK_CUR)) == -1L && - (e = GetLastError())) || - ((lend = GetFileSize(h, (DWORD *)&uend)) == -1L && (e = GetLastError()))) { + if ((lpos = SetFilePointer(h, 0, (upos = 0, &upos), SEEK_CUR)) == -1L && + (e = GetLastError())) { errno = map_errno(e); return -1; } - end = ((off_t)uend << 32) | (unsigned long)lend; usize = (long)(size >> 32); lsize = (long)size; if (SetFilePointer(h, lsize, &usize, SEEK_SET) == (DWORD)-1L && -- cgit v1.2.3