зеркало из https://github.com/github/ruby.git
* transcode.c (econv_putback): make max argument optional.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
97a5808a14
Коммит
d9c5f88abc
|
@ -1,3 +1,7 @@
|
|||
Sun Aug 31 04:38:47 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* transcode.c (econv_putback): make max argument optional.
|
||||
|
||||
Sun Aug 31 04:35:21 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* transcode.c (rb_econv_putback): putback from last byte.
|
||||
|
|
|
@ -478,7 +478,7 @@ class TestEncodingConverter < Test::Unit::TestCase
|
|||
ret = ec.primitive_convert(src="abc\xa1def", dst="", nil, 10)
|
||||
assert_equal(:invalid_byte_sequence, ret)
|
||||
assert_equal(["abc", "ef"], [dst, src])
|
||||
src = ec.putback(nil) + src
|
||||
src = ec.putback + src
|
||||
assert_equal(["abc", "def"], [dst, src])
|
||||
ret = ec.primitive_convert(src, dst, nil, 10)
|
||||
assert_equal(:finished, ret)
|
||||
|
|
|
@ -2727,12 +2727,14 @@ econv_insert_output(VALUE self, VALUE string)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
econv_putback(VALUE self, VALUE max)
|
||||
econv_putback(int argc, VALUE *argv, VALUE self)
|
||||
{
|
||||
rb_econv_t *ec = check_econv(self);
|
||||
int n;
|
||||
int putbackable;
|
||||
VALUE str;
|
||||
VALUE str, max;
|
||||
|
||||
rb_scan_args(argc, argv, "01", &max);
|
||||
|
||||
if (NIL_P(max))
|
||||
n = rb_econv_putbackable(ec);
|
||||
|
@ -2834,7 +2836,7 @@ Init_transcode(void)
|
|||
rb_define_method(rb_cEncodingConverter, "finish", econv_finish, 0);
|
||||
rb_define_method(rb_cEncodingConverter, "primitive_errinfo", econv_primitive_errinfo, 0);
|
||||
rb_define_method(rb_cEncodingConverter, "insert_output", econv_insert_output, 1);
|
||||
rb_define_method(rb_cEncodingConverter, "putback", econv_putback, 1);
|
||||
rb_define_method(rb_cEncodingConverter, "putback", econv_putback, -1);
|
||||
rb_define_const(rb_cEncodingConverter, "INVALID_MASK", INT2FIX(ECONV_INVALID_MASK));
|
||||
rb_define_const(rb_cEncodingConverter, "INVALID_IGNORE", INT2FIX(ECONV_INVALID_IGNORE));
|
||||
rb_define_const(rb_cEncodingConverter, "INVALID_REPLACE", INT2FIX(ECONV_INVALID_REPLACE));
|
||||
|
|
Загрузка…
Ссылка в новой задаче