зеркало из https://github.com/github/ruby.git
* include/ruby/encoding.h (rb_econv_t): add error_tc in last_error.
* transcode.c (rb_econv_convert): fill error_tc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
131e194cec
Коммит
7f0c5beb6f
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
12
transcode.c
12
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче