ruby-changes:3282
From: ko1@a...
Date: 29 Dec 2007 02:20:45 +0900
Subject: [ruby-changes:3282] usa - Ruby:r14775 (trunk): * io.c (io_unread): adhoc workaround for non-binary mode of some DOSish
usa 2007-12-29 02:20:24 +0900 (Sat, 29 Dec 2007) New Revision: 14775 Modified files: trunk/ChangeLog trunk/io.c trunk/version.h Log: * io.c (io_unread): adhoc workaround for non-binary mode of some DOSish platforms. this is not perfect and safety, but works with most cases. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/version.h?r1=14775&r2=14774 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14775&r2=14774 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/io.c?r1=14775&r2=14774 Index: ChangeLog =================================================================== --- ChangeLog (revision 14774) +++ ChangeLog (revision 14775) @@ -1,3 +1,8 @@ +Sat Dec 29 02:18:45 2007 NAKAMURA Usaku <usa@r...> + + * io.c (io_unread): adhoc workaround for non-binary mode of some DOSish + platforms. this is not perfect and safety, but works with most cases. + Fri Dec 28 23:53:18 2007 Tanaka Akira <akr@f...> * ext/strscan/strscan.c (str_new): new function for allocate an string Index: io.c =================================================================== --- io.c (revision 14774) +++ io.c (revision 14775) @@ -284,7 +284,19 @@ if (fptr->rbuf_len == 0 || fptr->mode & FMODE_DUPLEX) return; /* xxx: target position may be negative if buffer is filled by ungetc */ +#if defined(_WIN32) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__) + if (!(fptr->mode & FMODE_BINMODE)) { + int len = fptr->rbuf_len; + while (fptr->rbuf_len-- > 0) { + if (fptr->rbuf[fptr->rbuf_len] == '\n') + ++len; + } + r = lseek(fptr->fd, -len, SEEK_CUR); + } + else +#else r = lseek(fptr->fd, -fptr->rbuf_len, SEEK_CUR); +#endif if (r < 0) { if (errno == ESPIPE) fptr->mode |= FMODE_DUPLEX; Index: version.h =================================================================== --- version.h (revision 14774) +++ version.h (revision 14775) @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2007-12-28" +#define RUBY_RELEASE_DATE "2007-12-29" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20071228 +#define RUBY_RELEASE_CODE 20071229 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 12 -#define RUBY_RELEASE_DAY 28 +#define RUBY_RELEASE_DAY 29 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml