61 static int decode_string(
MLZ* mlz,
unsigned char *buff,
int string_code,
int *first_char_code,
unsigned long bufsize) {
63 unsigned long count,
offset;
64 int current_code, parent_code, tmp_code;
67 current_code = string_code;
70 while (count < bufsize) {
71 switch (current_code) {
77 *first_char_code = current_code;
78 buff[0] = current_code;
92 if ((current_code < 0) || (current_code > (
DIC_INDEX_MAX - 1))) {
117 for (
i = 0;
i <
len; ++
i) {
125 unsigned long output_chars;
126 int string_code, last_string_code, char_code;
130 last_string_code = -1;
133 while (output_chars <
size) {
135 switch (string_code) {
140 last_string_code = -1;
150 if (string_code == (
int) mlz->
bump_code) {
156 int ret =
decode_string(mlz, &buff[output_chars], last_string_code, &char_code,
size - output_chars);
157 if (ret < 0 || ret >
size - output_chars) {
163 if (ret < 0 || ret >
size - output_chars) {
175 int ret =
decode_string(mlz, &buff[output_chars], string_code, &char_code,
size - output_chars);
176 if (ret < 0 || ret >
size - output_chars) {
181 if (output_chars <= size && !mlz->freeze_flag) {
182 if (last_string_code != -1) {
194 last_string_code = string_code;