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

ruby-changes:7287

From: akr <ko1@a...>
Date: Sun, 24 Aug 2008 12:23:04 +0900 (JST)
Subject: [ruby-changes:7287] Ruby:r18806 (trunk): * include/ruby/encoding.h (rb_econv_substr_append): renamed from

akr	2008-08-24 12:22:43 +0900 (Sun, 24 Aug 2008)

  New Revision: 18806

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

  Log:
    * include/ruby/encoding.h (rb_econv_substr_append): renamed from
      rb_econv_string.
      (rb_econv_str_convert): declared.
      (rb_econv_substr_convert): declared.
      (rb_econv_str_append): declared.
    
    * io.c (io_fwrite): use rb_econv_str_convert instead of
      rb_econv_string.
    
    * transcode.c (rb_econv_substr_append): renamed from rb_econv_string.
      (rb_econv_str_append): new function.
      (rb_econv_substr_convert): ditto.
      (rb_econv_str_convert): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/encoding.h
    trunk/io.c
    trunk/transcode.c

Index: include/ruby/encoding.h
===================================================================
--- include/ruby/encoding.h	(revision 18805)
+++ include/ruby/encoding.h	(revision 18806)
@@ -274,7 +274,10 @@
 /* returns corresponding stateless encoding, or NULL if not stateful. */
 const char *rb_econv_stateless_encoding(const char *stateful_enc);
 
-VALUE rb_econv_string(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst, int flags);
+VALUE rb_econv_str_convert(rb_econv_t *ec, VALUE src, int flags);
+VALUE rb_econv_substr_convert(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, int flags);
+VALUE rb_econv_str_append(rb_econv_t *ec, VALUE src, VALUE dst, int flags);
+VALUE rb_econv_substr_append(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, VALUE dst, int flags);
 
 void rb_econv_binmode(rb_econv_t *ec);
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18805)
+++ ChangeLog	(revision 18806)
@@ -1,3 +1,19 @@
+Sun Aug 24 12:22:15 2008  Tanaka Akira  <akr@f...>
+
+	* include/ruby/encoding.h (rb_econv_substr_append): renamed from
+	  rb_econv_string.
+	  (rb_econv_str_convert): declared.
+	  (rb_econv_substr_convert): declared.
+	  (rb_econv_str_append): declared.
+
+	* io.c (io_fwrite): use rb_econv_str_convert instead of
+	  rb_econv_string.
+
+	* transcode.c (rb_econv_substr_append): renamed from rb_econv_string.
+	  (rb_econv_str_append): new function.
+	  (rb_econv_substr_convert): ditto.
+	  (rb_econv_str_convert): ditto.
+
 Sun Aug 24 12:15:12 2008  NARUSE, Yui  <naruse@r...>
 
 	* lib/net/http.rb (Net::HTTP#urlencode): str[0] returns char in 1.9.
Index: io.c
===================================================================
--- io.c	(revision 18805)
+++ io.c	(revision 18806)
@@ -745,7 +745,7 @@
             if (!NIL_P(fptr->writeconv_stateless)) {
                 str = rb_str_transcode(str, fptr->writeconv_stateless);
             }
-            str = rb_econv_string(fptr->writeconv, str, 0, RSTRING_LEN(str), Qnil, ECONV_PARTIAL_INPUT);
+            str = rb_econv_str_convert(fptr->writeconv, str, ECONV_PARTIAL_INPUT);
         }
         else {
             if (fptr->enc2)
Index: transcode.c
===================================================================
--- transcode.c	(revision 18805)
+++ transcode.c	(revision 18806)
@@ -1327,16 +1327,15 @@
 }
 
 VALUE
-rb_econv_string(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst, int flags)
+rb_econv_substr_append(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst, int flags)
 {
     unsigned const char *ss, *sp, *se;
     unsigned char *ds, *dp, *de;
     rb_econv_result_t res;
     int max_output;
 
-    if (NIL_P(dst)) {
+    if (NIL_P(dst))
         dst = rb_str_buf_new(len);
-    }
 
     if (ec->last_tc)
         max_output = ec->last_tc->transcoder->max_output;
@@ -1367,6 +1366,24 @@
     return dst;
 }
 
+VALUE
+rb_econv_str_append(rb_econv_t *ec, VALUE src, VALUE dst, int flags)
+{
+    return rb_econv_substr_append(ec, src, 0, RSTRING_LEN(src), dst, flags);
+}
+
+VALUE
+rb_econv_substr_convert(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, int flags)
+{
+    return rb_econv_substr_append(ec, src, byteoff, bytesize, Qnil, flags);
+}
+
+VALUE
+rb_econv_str_convert(rb_econv_t *ec, VALUE src, int flags)
+{
+    return rb_econv_substr_append(ec, src, 0, RSTRING_LEN(src), Qnil, flags);
+}
+
 void
 rb_econv_binmode(rb_econv_t *ec)
 {

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

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