summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-24 03:22:43 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-24 03:22:43 +0000
commitbc0efbc9cd875ef4582cfc421297ec7cfbbfcb78 (patch)
tree47d0543ac4d9a8b5339fa97b17c52eb6d5b7c01f
parenta65d2e05740d6602158dc4fdc2d53ad47cbf45fc (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog16
-rw-r--r--include/ruby/encoding.h5
-rw-r--r--io.c2
-rw-r--r--transcode.c23
4 files changed, 41 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index b241b38994..7e8e4aa381 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+Sun Aug 24 12:22:15 2008 Tanaka Akira <akr@fsij.org>
+
+ * 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@ruby-lang.org>
* lib/net/http.rb (Net::HTTP#urlencode): str[0] returns char in 1.9.
diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h
index 748c8cff53..9336e6d346 100644
--- a/include/ruby/encoding.h
+++ b/include/ruby/encoding.h
@@ -274,7 +274,10 @@ void rb_econv_putback(rb_econv_t *ec, unsigned char *p, int n);
/* 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);
diff --git a/io.c b/io.c
index 15eaba9d93..702e287066 100644
--- a/io.c
+++ b/io.c
@@ -745,7 +745,7 @@ io_fwrite(VALUE str, rb_io_t *fptr)
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)
diff --git a/transcode.c b/transcode.c
index 5e14a358b8..1ba30c8256 100644
--- a/transcode.c
+++ b/transcode.c
@@ -1327,16 +1327,15 @@ 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)
+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 @@ rb_econv_string(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst, int fl
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)
{