summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-15 15:42:30 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-15 15:42:30 +0000
commit6eb3843b178c5bca28a3c8d73b8af5f58de21e22 (patch)
tree43f2e7802ee8ffd52e4f27952d3fffbb3978db38 /transcode.c
parent69029b90fea8a6b7e5607ead5e2184da30db9e76 (diff)
* transcode_data.h (STR1_LENGTH): defined.
(makeSTR1LEN): defined. * tool/transcode-tblgen.rb: use makeSTR1LEN. generate STR1 for 4 to 259 bytes. * transcode.c (rb_transcoding): new field: output_index. (transcode_restartable0): use STR1_LENGTH. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/transcode.c b/transcode.c
index e883133428..5bd8e009ca 100644
--- a/transcode.c
+++ b/transcode.c
@@ -52,6 +52,7 @@ typedef struct rb_transcoding {
unsigned int next_table;
VALUE next_info;
unsigned char next_byte;
+ unsigned int output_index;
int recognized_len; /* already interpreted */
int readagain_len; /* not yet interpreted */
@@ -584,10 +585,10 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos,
SUSPEND_OBUF(19); *out_p++ = getBT3(next_info);
continue;
case STR1:
- next_byte = 0; /* index */
- while (next_byte < BYTE_ADDR(STR1_BYTEINDEX(next_info))[0]) {
- SUSPEND_OBUF(28); *out_p++ = BYTE_ADDR(STR1_BYTEINDEX(next_info))[1+next_byte];
- next_byte++;
+ tc->output_index = 0;
+ while (tc->output_index < STR1_LENGTH(BYTE_ADDR(STR1_BYTEINDEX(next_info)))) {
+ SUSPEND_OBUF(28); *out_p++ = BYTE_ADDR(STR1_BYTEINDEX(next_info))[1+tc->output_index];
+ tc->output_index++;
}
continue;
case FUNii: