diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-13 08:28:39 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-13 08:28:39 +0000 |
commit | 04f7390ca828ee6c2482036b0d6834ca6d86ded9 (patch) | |
tree | 8f196b7e3c6c55bc4dd43b543f9b11bbbf5b58dc /transcode_data.h | |
parent | 8f1e7a37e520fd1b105bec102cb05d2b49acf4a2 (diff) |
* transcode_data.h (rb_transcoding): add fields: writebuf_off,
writebuf_len and writebuf.
(TRANSCODING_WRITEBUF): new macro.
* transcode.c (transcode_restartable0): output until output buffer is
really full.
(rb_transcoding_open_by_transcoder): initialize writebuf_len,
writebuf_off and writebuf.
(rb_transcoding_close): finalize writebuf.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode_data.h')
-rw-r--r-- | transcode_data.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/transcode_data.h b/transcode_data.h index f49f796f3d..d8ced64d29 100644 --- a/transcode_data.h +++ b/transcode_data.h @@ -69,19 +69,31 @@ typedef struct rb_transcoding { const BYTE_LOOKUP *next_table; VALUE next_info; unsigned char next_byte; + int recognized_len; /* already interpreted */ int readagain_len; /* not yet interpreted */ union { unsigned char ary[8]; /* max_input <= sizeof(ary) */ - unsigned char *ptr; /* length is max_input */ + unsigned char *ptr; /* length: max_input */ } readbuf; /* recognized_len + readagain_len used */ + int writebuf_off; + int writebuf_len; + union { + unsigned char ary[8]; /* max_output <= sizeof(ary) */ + unsigned char *ptr; /* length: max_output */ + } writebuf; + unsigned char stateful[256]; /* opaque data for stateful encoding */ } rb_transcoding; #define TRANSCODING_READBUF(tc) \ ((tc)->transcoder->max_input <= sizeof((tc)->readbuf.ary) ? \ (tc)->readbuf.ary : \ (tc)->readbuf.ptr) +#define TRANSCODING_WRITEBUF(tc) \ + ((tc)->transcoder->max_output <= sizeof((tc)->writebuf.ary) ? \ + (tc)->writebuf.ary : \ + (tc)->writebuf.ptr) /* static structure, one per supported encoding pair */ struct rb_transcoder { |