1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2012-01-16 02:22:47 +00:00
parent d3f8488b1c
commit 688d00d23b
2 changed files with 7 additions and 6 deletions

View file

@ -1,3 +1,7 @@
Mon Jan 16 11:22:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/win32.c (rb_chsize): no need to get the current file size.
Mon Jan 16 00:41:33 2012 Sokolov Yura <funny.falcon@gmail.com>
* st.c: st use function instead of macro. In my current

View file

@ -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 &&