* ext/strscan/strscan.c (strscan_initialize, strscan_getch): use the
encoding of the target string instead of setting to StringScanner instance. [ruby-dev:31831] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
11dc2b9641
commit
7ab48f03e9
@ -1,3 +1,9 @@
|
|||||||
|
Mon Sep 24 17:56:21 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/strscan/strscan.c (strscan_initialize, strscan_getch): use the
|
||||||
|
encoding of the target string instead of setting to StringScanner
|
||||||
|
instance. [ruby-dev:31831]
|
||||||
|
|
||||||
Mon Sep 24 16:52:11 2007 Urabe Shyouhei <shyouhei@ruby-lang.org>
|
Mon Sep 24 16:52:11 2007 Urabe Shyouhei <shyouhei@ruby-lang.org>
|
||||||
|
|
||||||
* lib/net/http.rb: fix typo.
|
* lib/net/http.rb: fix typo.
|
||||||
|
@ -190,7 +190,6 @@ strscan_initialize(int argc, VALUE *argv, VALUE self)
|
|||||||
rb_scan_args(argc, argv, "11", &str, &need_dup);
|
rb_scan_args(argc, argv, "11", &str, &need_dup);
|
||||||
StringValue(str);
|
StringValue(str);
|
||||||
p->str = str;
|
p->str = str;
|
||||||
rb_enc_associate(self, rb_enc_get(str));
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -654,14 +653,13 @@ strscan_getch(VALUE self)
|
|||||||
{
|
{
|
||||||
struct strscanner *p;
|
struct strscanner *p;
|
||||||
long len;
|
long len;
|
||||||
rb_encoding *enc = rb_enc_get(self);
|
|
||||||
|
|
||||||
GET_SCANNER(self, p);
|
GET_SCANNER(self, p);
|
||||||
CLEAR_MATCH_STATUS(p);
|
CLEAR_MATCH_STATUS(p);
|
||||||
if (EOS_P(p))
|
if (EOS_P(p))
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
|
||||||
len = rb_enc_mbclen(CURPTR(p), S_PEND(p), enc);
|
len = rb_enc_mbclen(CURPTR(p), S_PEND(p), rb_enc_get(p->str));
|
||||||
if (p->curr + len > S_LEN(p)) {
|
if (p->curr + len > S_LEN(p)) {
|
||||||
len = S_LEN(p) - p->curr;
|
len = S_LEN(p) - p->curr;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user