… | |
… | |
16 | along with this program; if not, write to the Free Software |
16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
18 | */ |
18 | */ |
19 | |
19 | |
20 | #include "config.h" |
20 | #include "config.h" |
|
|
21 | #include "compat.h" |
|
|
22 | |
21 | #include <stdlib.h> |
23 | #include <stdlib.h> |
|
|
24 | |
22 | #include "parse_routines.h" |
25 | #include "parse_routines.h" |
|
|
26 | #include "error.h" |
23 | |
27 | |
24 | int psiconv_parse_word_status_section(const psiconv_buffer buf, int lev, |
28 | int psiconv_parse_word_status_section(const psiconv_buffer buf, int lev, |
25 | psiconv_u32 off, int *length, |
29 | psiconv_u32 off, int *length, |
26 | psiconv_word_status_section *result) |
30 | psiconv_word_status_section *result) |
27 | { |
31 | { |
… | |
… | |
133 | psiconv_debug(lev+2,off+len,"Cursor position: %08x", |
137 | psiconv_debug(lev+2,off+len,"Cursor position: %08x", |
134 | (*result)->cursor_position); |
138 | (*result)->cursor_position); |
135 | len += 0x04; |
139 | len += 0x04; |
136 | |
140 | |
137 | psiconv_progress(lev+2,off+len,"Going to read display size"); |
141 | psiconv_progress(lev+2,off+len,"Going to read display size"); |
138 | (*result)->cursor_position = psiconv_read_u32(buf,lev+2,off + len,&res); |
142 | (*result)->display_size = psiconv_read_u32(buf,lev+2,off + len,&res); |
139 | if (res) |
143 | if (res) |
140 | goto ERROR2; |
144 | goto ERROR2; |
141 | psiconv_debug(lev+2,off+len,"Display size: %08x", |
145 | psiconv_debug(lev+2,off+len,"Display size: %08x", |
142 | (*result)->cursor_position); |
146 | (*result)->display_size); |
143 | len += 0x04; |
147 | len += 0x04; |
144 | |
148 | |
145 | if (length) |
149 | if (length) |
146 | *length = len; |
150 | *length = len; |
147 | |
151 | |
… | |
… | |
319 | style->paragraph))) |
323 | style->paragraph))) |
320 | goto ERROR8; |
324 | goto ERROR8; |
321 | len += leng; |
325 | len += leng; |
322 | } |
326 | } |
323 | |
327 | |
|
|
328 | psiconv_progress(lev+2,off+len,"Reading trailing bytes"); |
|
|
329 | for (i = 0; i < 3; i++) { |
|
|
330 | temp = psiconv_read_u8(buf,lev+3,off+len,&res); |
|
|
331 | if (res) |
|
|
332 | goto ERROR4; |
|
|
333 | if (temp != 0xff) { |
|
|
334 | psiconv_warn(lev+3,off+len,"Unknown trailing style byte"); |
|
|
335 | psiconv_debug(lev+3,off+len,"Trailing byte: %02x expected, read %02x", |
|
|
336 | 0xff,temp); |
|
|
337 | } else |
|
|
338 | psiconv_debug(lev+3,off+len,"Read trailing byte 0xff"); |
|
|
339 | len++; |
|
|
340 | } |
|
|
341 | |
324 | if (length) |
342 | if (length) |
325 | *length = len; |
343 | *length = len; |
326 | |
344 | |
327 | psiconv_progress(lev,off+len-1, |
345 | psiconv_progress(lev,off+len-1, |
328 | "End of word styles section (total length: %08x)", len); |
346 | "End of word styles section (total length: %08x)", len); |