[前][次][番号順一覧][スレッド一覧]

ruby-changes:22266

From: nobu <ko1@a...>
Date: Mon, 16 Jan 2012 11:23:01 +0900 (JST)
Subject: [ruby-changes:22266] nobu:r34315 (trunk): * win32/win32.c (rb_chsize): no need to get the current file size.

nobu	2012-01-16 11:22:47 +0900 (Mon, 16 Jan 2012)

  New Revision: 34315

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34315

  Log:
    * win32/win32.c (rb_chsize): no need to get the current file size.

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 34314)
+++ ChangeLog	(revision 34315)
@@ -1,3 +1,7 @@
+Mon Jan 16 11:22:38 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* win32/win32.c (rb_chsize): no need to get the current file size.
+
 Mon Jan 16 00:41:33 2012  Sokolov Yura  <funny.falcon@g...>
 
 	* st.c: st use function instead of macro.  In my current
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 34314)
+++ win32/win32.c	(revision 34315)
@@ -4676,18 +4676,15 @@
 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 &&

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]