ruby-changes:3562
From: ko1@a...
Date: Tue, 15 Jan 2008 00:08:11 +0900 (JST)
Subject: [ruby-changes:3562] matz - Ruby:r15051 (trunk): * io.c (appendline): specifying limit should not generate broken
matz 2008-01-15 00:07:49 +0900 (Tue, 15 Jan 2008)
New Revision: 15051
Modified files:
trunk/ChangeLog
trunk/io.c
trunk/version.h
Log:
* io.c (appendline): specifying limit should not generate broken
byte sequence. strings should be rounded. [ruby-dev:33088]
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/version.h?r1=15051&r2=15050&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15051&r2=15050&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/io.c?r1=15051&r2=15050&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 15050)
+++ ChangeLog (revision 15051)
@@ -1,3 +1,8 @@
+Tue Jan 15 00:05:50 2008 Yukihiro Matsumoto <matz@r...>
+
+ * io.c (appendline): specifying limit should not generate broken
+ byte sequence. strings should be rounded. [ruby-dev:33088]
+
Mon Jan 14 23:33:02 2008 NARUSE, Yui <naruse@r...>
* ext/nkf/lib/kconv.rb (Kconv.tolocale): argument is str.
Index: io.c
===================================================================
--- io.c (revision 15050)
+++ io.c (revision 15051)
@@ -1712,6 +1712,18 @@
if (c != EOF) {
RSTRING_PTR(str)[last++] = c;
}
+ if (limit > 0 && limit == pending) {
+ char *p = fptr->rbuf+fptr->rbuf_off;
+ char *pp = p + limit;
+ char *pl = rb_enc_left_char_head(p, pp, io_read_encoding(fptr));
+
+ if (pl < pp) {
+ int diff = pp - pl;
+ pending -= diff;
+ limit = pending;
+ rb_str_set_len(str, RSTRING_LEN(str)-diff);
+ }
+ }
read_buffered_data(RSTRING_PTR(str) + last, pending, fptr); /* must not fail */
limit -= pending;
*lp = limit;
Index: version.h
===================================================================
--- version.h (revision 15050)
+++ version.h (revision 15051)
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2008-01-14"
+#define RUBY_RELEASE_DATE "2008-01-15"
#define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20080114
+#define RUBY_RELEASE_CODE 20080115
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 1
-#define RUBY_RELEASE_DAY 14
+#define RUBY_RELEASE_DAY 15
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/