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

ruby-changes:8482

From: usa <ko1@a...>
Date: Wed, 29 Oct 2008 11:02:14 +0900 (JST)
Subject: [ruby-changes:8482] Ruby:r20015 (ruby_1_9_1): * win32/win32.c (rb_w32_open): shouldn't seek here.

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

  New Revision: 20015

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

  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:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/win32/win32.c

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 20014)
+++ ruby_1_9_1/ChangeLog	(revision 20015)
@@ -1,3 +1,10 @@
+Wed Oct 29 11:01:46 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 00:29:46 2008  NAKAMURA Usaku  <usa@r...>
 
 	* win32/win32.c (rb_w32_open): need to seek to the end of the file when
Index: ruby_1_9_1/win32/win32.c
===================================================================
--- ruby_1_9_1/win32/win32.c	(revision 20014)
+++ ruby_1_9_1/win32/win32.c	(revision 20015)
@@ -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/

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