… | |
… | |
22 | |
22 | |
23 | #include <stdlib.h> |
23 | #include <stdlib.h> |
24 | |
24 | |
25 | #include "parse_routines.h" |
25 | #include "parse_routines.h" |
26 | #include "error.h" |
26 | #include "error.h" |
|
|
27 | |
|
|
28 | #ifdef DMALLOC |
|
|
29 | #include <dmalloc.h> |
|
|
30 | #endif |
27 | |
31 | |
28 | int psiconv_parse_word_status_section(const psiconv_buffer buf, int lev, |
32 | int psiconv_parse_word_status_section(const psiconv_buffer buf, int lev, |
29 | psiconv_u32 off, int *length, |
33 | psiconv_u32 off, int *length, |
30 | psiconv_word_status_section *result) |
34 | psiconv_word_status_section *result) |
31 | { |
35 | { |
… | |
… | |
137 | psiconv_debug(lev+2,off+len,"Cursor position: %08x", |
141 | psiconv_debug(lev+2,off+len,"Cursor position: %08x", |
138 | (*result)->cursor_position); |
142 | (*result)->cursor_position); |
139 | len += 0x04; |
143 | len += 0x04; |
140 | |
144 | |
141 | psiconv_progress(lev+2,off+len,"Going to read display size"); |
145 | psiconv_progress(lev+2,off+len,"Going to read display size"); |
142 | (*result)->cursor_position = psiconv_read_u32(buf,lev+2,off + len,&res); |
146 | (*result)->display_size = psiconv_read_u32(buf,lev+2,off + len,&res); |
143 | if (res) |
147 | if (res) |
144 | goto ERROR2; |
148 | goto ERROR2; |
145 | psiconv_debug(lev+2,off+len,"Display size: %08x", |
149 | psiconv_debug(lev+2,off+len,"Display size: %08x", |
146 | (*result)->cursor_position); |
150 | (*result)->display_size); |
147 | len += 0x04; |
151 | len += 0x04; |
148 | |
152 | |
149 | if (length) |
153 | if (length) |
150 | *length = len; |
154 | *length = len; |
151 | |
155 | |
… | |
… | |
323 | style->paragraph))) |
327 | style->paragraph))) |
324 | goto ERROR8; |
328 | goto ERROR8; |
325 | len += leng; |
329 | len += leng; |
326 | } |
330 | } |
327 | |
331 | |
|
|
332 | psiconv_progress(lev+2,off+len,"Reading trailing bytes"); |
|
|
333 | for (i = 0; i < psiconv_list_length((*result)->styles); i++) { |
|
|
334 | temp = psiconv_read_u8(buf,lev+3,off+len,&res); |
|
|
335 | if (res) |
|
|
336 | goto ERROR4; |
|
|
337 | if (temp != 0xff) { |
|
|
338 | psiconv_warn(lev+3,off+len,"Unknown trailing style byte"); |
|
|
339 | psiconv_debug(lev+3,off+len,"Trailing byte: %02x expected, read %02x", |
|
|
340 | 0xff,temp); |
|
|
341 | } else |
|
|
342 | psiconv_debug(lev+3,off+len,"Read trailing byte 0xff"); |
|
|
343 | len++; |
|
|
344 | } |
|
|
345 | |
328 | if (length) |
346 | if (length) |
329 | *length = len; |
347 | *length = len; |
330 | |
348 | |
331 | psiconv_progress(lev,off+len-1, |
349 | psiconv_progress(lev,off+len-1, |
332 | "End of word styles section (total length: %08x)", len); |
350 | "End of word styles section (total length: %08x)", len); |