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

ruby-changes:14762

From: matz <ko1@a...>
Date: Tue, 9 Feb 2010 00:08:33 +0900 (JST)
Subject: [ruby-changes:14762] Ruby:r26622 (trunk): * io.c (rb_io_getline_fast): wrong calculation of new position

matz	2010-02-09 00:08:15 +0900 (Tue, 09 Feb 2010)

  New Revision: 26622

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

  Log:
    * io.c (rb_io_getline_fast): wrong calculation of new position
      from rb_str_coderange_scan_restartable().  [ruby-core:28103]
    
    * io.c (read_all): ditto.  
    
    * sprintf.c (rb_str_format): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/io.c
    trunk/sprintf.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 26621)
+++ ChangeLog	(revision 26622)
@@ -1,3 +1,12 @@
+Mon Feb  8 23:49:24 2010  Yukihiro Matsumoto  <matz@r...>
+
+	* io.c (rb_io_getline_fast): wrong calculation of new position
+	  from rb_str_coderange_scan_restartable().  [ruby-core:28103]
+
+	* io.c (read_all): ditto.  
+
+	* sprintf.c (rb_str_format): ditto.
+
 Mon Feb  8 21:03:53 2010  Tanaka Akira  <akr@f...>
 
 	* ext/socket/socket.c (socket_s_ip_address_list): obtain the scope_id
Index: io.c
===================================================================
--- io.c	(revision 26621)
+++ io.c	(revision 26622)
@@ -2287,7 +2287,7 @@
 	    }
 	    len += pending;
 	    if (cr != ENC_CODERANGE_BROKEN)
-		pos = rb_str_coderange_scan_restartable(RSTRING_PTR(str) + pos, RSTRING_PTR(str) + len, enc, &cr);
+		pos += rb_str_coderange_scan_restartable(RSTRING_PTR(str) + pos, RSTRING_PTR(str) + len, enc, &cr);
 	    if (e) break;
 	}
 	rb_thread_wait_fd(fptr->fd);
Index: sprintf.c
===================================================================
--- sprintf.c	(revision 26621)
+++ sprintf.c	(revision 26622)
@@ -483,7 +483,7 @@
 	for (t = p; t < end && *t != '%'; t++) ;
 	PUSH(p, t - p);
 	if (coderange != ENC_CODERANGE_BROKEN && scanned < blen) {
-	    scanned = rb_str_coderange_scan_restartable(buf+scanned, buf+blen, enc, &coderange);
+	    scanned += rb_str_coderange_scan_restartable(buf+scanned, buf+blen, enc, &coderange);
 	    ENC_CODERANGE_SET(result, coderange);
 	}
 	if (t >= end) {
@@ -672,7 +672,7 @@
 		rb_str_set_len(result, blen);
 		if (coderange != ENC_CODERANGE_BROKEN && scanned < blen) {
 		    int cr = coderange;
-		    scanned = rb_str_coderange_scan_restartable(buf+scanned, buf+blen, enc, &cr);
+		    scanned += rb_str_coderange_scan_restartable(buf+scanned, buf+blen, enc, &cr);
 		    ENC_CODERANGE_SET(result,
 				      (cr == ENC_CODERANGE_UNKNOWN ?
 				       ENC_CODERANGE_BROKEN : (coderange = cr)));

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

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