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

ruby-changes:8481

From: usa <ko1@a...>
Date: Wed, 29 Oct 2008 11:01:41 +0900 (JST)
Subject: [ruby-changes:8481] Ruby:r20014 (trunk): * win32/win32.c (rb_w32_open): shouldn't seek here.

usa	2008-10-29 11:01:19 +0900 (Wed, 29 Oct 2008)

  New Revision: 20014

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

  Log:
    * win32/win32.c (rb_w32_open): shouldn't seek here.
    * win32/win32.c (rb_w32_write): write to the end of the file when
      FAPPEND is specified.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 20013)
+++ ChangeLog	(revision 20014)
@@ -1,3 +1,10 @@
+Wed Oct 29 11:00:25 2008  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (rb_w32_open): shouldn't seek here.
+
+	* win32/win32.c (rb_w32_write): write to the end of the file when
+	  FAPPEND is specified.
+
 Wed Oct 29 09:30:04 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* ruby.c (load_file_internal): use ASCII-8BIT to prevent conversion.
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 20013)
+++ win32/win32.c	(revision 20014)
@@ -4129,10 +4129,8 @@
 	    fd = -1;
 	    goto quit;
 	}
-	if (!(flags & (FDEV | FPIPE)) && (oflag & O_APPEND)) {
+	if (!(flags & (FDEV | FPIPE)) && (oflag & O_APPEND))
 	    flags |= FAPPEND;
-	    SetFilePointer(h, 0, NULL, FILE_END);
-	}
 
 	_set_osfhnd(fd, (long)h);
 	_osfile(fd) = flags | FOPEN;
@@ -4431,8 +4429,8 @@
 	memset(&ol, 0, sizeof(ol));
 	if (!(_osfile(fd) & (FDEV | FPIPE))) {
 	    LONG high = 0;
-	    DWORD low = SetFilePointer((HANDLE)_osfhnd(fd), 0, &high,
-				       FILE_CURRENT);
+	    DWORD method = _osfile(fd) & FAPPEND ? FILE_END : FILE_CURRENT;
+	    DWORD low = SetFilePointer((HANDLE)_osfhnd(fd), 0, &high, method);
 #ifndef INVALID_SET_FILE_POINTER
 #define INVALID_SET_FILE_POINTER ((DWORD)-1)
 #endif

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

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