From 6eb3843b178c5bca28a3c8d73b8af5f58de21e22 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 15 Sep 2008 15:42:30 +0000 Subject: * 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 --- transcode.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'transcode.c') 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: -- cgit v1.2.3