summaryrefslogtreecommitdiffstats
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
commite116a38c446cc34777f33e7a42e7d043f0b05c18 (patch)
tree43f2e7802ee8ffd52e4f27952d3fffbb3978db38 /transcode.c
parent6301c4ddcc143dbee634fd378b77d0aacfcb4e1b (diff)
downloadruby-e116a38c446cc34777f33e7a42e7d043f0b05c18.tar.gz
ruby-e116a38c446cc34777f33e7a42e7d043f0b05c18.tar.xz
ruby-e116a38c446cc34777f33e7a42e7d043f0b05c18.zip
* 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: http://svn.ruby-lang.org/repos/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 e88313342..5bd8e009c 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: