summaryrefslogtreecommitdiff
path: root/transcode_data.h
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-13 08:28:39 (GMT)
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-13 08:28:39 (GMT)
commit04f7390ca828ee6c2482036b0d6834ca6d86ded9 (patch)
tree8f196b7e3c6c55bc4dd43b543f9b11bbbf5b58dc /transcode_data.h
parent8f1e7a37e520fd1b105bec102cb05d2b49acf4a2 (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.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/transcode_data.h b/transcode_data.h
index f49f796..d8ced64 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 {