66 static int decode_string(
MLZ* mlz,
unsigned char *buff,
int string_code,
int *first_char_code,
unsigned long bufsize) {
68 unsigned long count,
offset;
69 int current_code, parent_code, tmp_code;
72 current_code = string_code;
75 while (count < bufsize) {
76 switch (current_code) {
82 *first_char_code = current_code;
83 buff[0] = current_code;
97 if ((current_code < 0) || (current_code > (
DIC_INDEX_MAX - 1))) {
122 for (
i = 0;
i <
len; ++
i) {
130 unsigned long output_chars;
131 int string_code, last_string_code, char_code;
135 last_string_code = -1;
138 while (output_chars <
size) {
140 switch (string_code) {
145 last_string_code = -1;
155 if (string_code == (
int) mlz->
bump_code) {
161 int ret =
decode_string(mlz, &buff[output_chars], last_string_code, &char_code,
size - output_chars);
162 if (ret < 0 || ret >
size - output_chars) {
168 if (ret < 0 || ret >
size - output_chars) {
180 int ret =
decode_string(mlz, &buff[output_chars], string_code, &char_code,
size - output_chars);
181 if (ret < 0 || ret >
size - output_chars) {
186 if (output_chars <= size && !mlz->freeze_flag) {
187 if (last_string_code != -1) {
199 last_string_code = string_code;