67 static int decode_string(
MLZ* mlz,
unsigned char *buff,
int string_code,
int *first_char_code,
unsigned long bufsize) {
69 unsigned long count,
offset;
70 int current_code, parent_code, tmp_code;
73 current_code = string_code;
76 while (count < bufsize) {
77 switch (current_code) {
83 *first_char_code = current_code;
84 buff[0] = current_code;
98 if ((current_code < 0) || (current_code > (
DIC_INDEX_MAX - 1))) {
123 for (
i = 0;
i <
len; ++
i) {
131 unsigned long output_chars;
132 int string_code, last_string_code, char_code;
136 last_string_code = -1;
139 while (output_chars <
size) {
141 switch (string_code) {
146 last_string_code = -1;
156 if (string_code == (
int) mlz->
bump_code) {
162 int ret =
decode_string(mlz, &buff[output_chars], last_string_code, &char_code,
size - output_chars);
163 if (ret < 0 || ret >
size - output_chars) {
169 if (ret < 0 || ret >
size - output_chars) {
181 int ret =
decode_string(mlz, &buff[output_chars], string_code, &char_code,
size - output_chars);
182 if (ret < 0 || ret >
size - output_chars) {
187 if (output_chars <= size && !mlz->freeze_flag) {
188 if (last_string_code != -1) {
200 last_string_code = string_code;