diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-15 09:33:59 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-15 09:33:59 +0000 |
| commit | f22e484a70bc5f1478d2bd78a0d1994d5bb384aa (patch) | |
| tree | 0cb20d42fb041bafac5331dc9528692a8f3b739e | |
| parent | 6cc0c60ef2d2901e2aac45561ab7e2ab6b9c4c3e (diff) | |
| download | ruby-f22e484a70bc5f1478d2bd78a0d1994d5bb384aa.tar.gz ruby-f22e484a70bc5f1478d2bd78a0d1994d5bb384aa.tar.xz ruby-f22e484a70bc5f1478d2bd78a0d1994d5bb384aa.zip | |
* include/ruby/encoding.h (rb_econv_t): add error_tc in last_error.
* transcode.c (rb_econv_convert): fill error_tc.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | include/ruby/encoding.h | 1 | ||||
| -rw-r--r-- | transcode.c | 12 |
3 files changed, 14 insertions, 5 deletions
@@ -1,3 +1,9 @@ +Fri Aug 15 18:33:22 2008 Tanaka Akira <akr@fsij.org> + + * include/ruby/encoding.h (rb_econv_t): add error_tc in last_error. + + * transcode.c (rb_econv_convert): fill error_tc. + Fri Aug 15 18:10:49 2008 Tanaka Akira <akr@fsij.org> * include/ruby/encoding.h (rb_econv_t): new field: last_error. diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index 675bd5d90..e4259845e 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -227,6 +227,7 @@ typedef struct { /* last error */ struct { rb_econv_result_t result; + struct rb_transcoding *error_tc; const char *source_encoding; const char *destination_encoding; const unsigned char *error_bytes_start; diff --git a/transcode.c b/transcode.c index 92d9ec62f..a814eb988 100644 --- a/transcode.c +++ b/transcode.c @@ -950,11 +950,13 @@ rb_econv_convert(rb_econv_t *ec, ec->last_error.partial_input = flags & ECONV_PARTIAL_INPUT; if (res == econv_invalid_byte_sequence || res == econv_undefined_conversion) { - ec->last_error.source_encoding = ec->elems[result_position].tc->transcoder->from_encoding; - ec->last_error.destination_encoding = ec->elems[result_position].tc->transcoder->to_encoding; - ec->last_error.error_bytes_start = TRANSCODING_READBUF(ec->elems[result_position].tc); - ec->last_error.error_bytes_len = ec->elems[result_position].tc->recognized_len; - ec->last_error.readagain_len = ec->elems[result_position].tc->readagain_len; + rb_transcoding *error_tc = ec->elems[result_position].tc; + ec->last_error.error_tc = error_tc; + ec->last_error.source_encoding = error_tc->transcoder->from_encoding; + ec->last_error.destination_encoding = error_tc->transcoder->to_encoding; + ec->last_error.error_bytes_start = TRANSCODING_READBUF(error_tc); + ec->last_error.error_bytes_len = error_tc->recognized_len; + ec->last_error.readagain_len = error_tc->readagain_len; } return res; |
