From 688d00d23b9280d75a75c129382408a057c7109d Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 16 Jan 2012 02:22:47 +0000 Subject: [PATCH] * 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 --- ChangeLog | 4 ++++ win32/win32.c | 9 +++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2e48cba9e..ec0bf7615a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Jan 16 11:22:38 2012 Nobuyoshi Nakada + + * win32/win32.c (rb_chsize): no need to get the current file size. + Mon Jan 16 00:41:33 2012 Sokolov Yura * st.c: st use function instead of macro. In my current 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 &&