summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/transcode.c b/transcode.c
index add97c96958..c6c828cbb4c 100644
--- a/transcode.c
+++ b/transcode.c
@@ -480,7 +480,7 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos,
while (1) {
inchar_start = in_p;
tc->recognized_len = 0;
- next_table = ((uintptr_t)tr->word_array) + tr->conv_tree_start;
+ next_table = tr->conv_tree_start;
SUSPEND_OUTPUT_FOLLOWED_BY_INPUT(24);
@@ -493,12 +493,14 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos,
next_byte = (unsigned char)*in_p++;
follow_byte:
-#define BL_BASE(next_table) (tr->byte_array + BYTE_LOOKUP_BASE(next_table))
+#define BL_BASE(next_table) \
+ (tr->byte_array + BYTE_LOOKUP_BASE(tr->word_array + next_table/sizeof(*tr->word_array)))
if (next_byte < BL_BASE(next_table)[0] || BL_BASE(next_table)[1] < next_byte)
next_info = INVALID;
else {
unsigned int next_offset = BL_BASE(next_table)[2+next_byte-BL_BASE(next_table)[0]];
-#define BL_INFO(next_table) ((const struct byte_lookup *const *)(((uintptr_t)tr->word_array) + BYTE_LOOKUP_INFO(next_table)))
+#define BL_INFO(next_table) \
+ (tr->word_array + BYTE_LOOKUP_INFO(tr->word_array + next_table/sizeof(*tr->word_array))/sizeof(*tr->word_array))
next_info = (VALUE)BL_INFO(next_table)[next_offset];
}
follow_info:
@@ -515,7 +517,7 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos,
SUSPEND(econv_source_buffer_empty, 5);
}
next_byte = (unsigned char)*in_p++;
- next_table = ((uintptr_t)tr->word_array) + next_info;
+ next_table = next_info;
goto follow_byte;
case ZERObt: /* drop input */
continue;