… | |
… | |
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> |
22 | |
24 | |
23 | #include "data.h" |
|
|
24 | #include "parse_routines.h" |
25 | #include "parse_routines.h" |
|
|
26 | #include "error.h" |
|
|
27 | |
|
|
28 | #ifdef DMALLOC |
|
|
29 | #include <dmalloc.h> |
|
|
30 | #endif |
|
|
31 | |
25 | |
32 | |
26 | int psiconv_parse_jumptable_section(const psiconv_buffer buf,int lev, |
33 | int psiconv_parse_jumptable_section(const psiconv_buffer buf,int lev, |
27 | psiconv_u32 off, int *length, |
34 | psiconv_u32 off, int *length, |
28 | psiconv_jumptable_section *result) |
35 | psiconv_jumptable_section *result) |
29 | { |
36 | { |
… | |
… | |
36 | if (!((*result) = psiconv_list_new(sizeof(psiconv_u32)))) |
43 | if (!((*result) = psiconv_list_new(sizeof(psiconv_u32)))) |
37 | goto ERROR1; |
44 | goto ERROR1; |
38 | |
45 | |
39 | psiconv_progress(lev+2,off+len,"Going to read the list length"); |
46 | psiconv_progress(lev+2,off+len,"Going to read the list length"); |
40 | listlen = psiconv_read_u32(buf,lev+2,off+len,&res); |
47 | listlen = psiconv_read_u32(buf,lev+2,off+len,&res); |
41 | if (!res) |
48 | if (res) |
42 | goto ERROR2; |
49 | goto ERROR2; |
43 | psiconv_debug(lev+2,off+len,"List length: %08x",listlen); |
50 | psiconv_debug(lev+2,off+len,"List length: %08x",listlen); |
44 | len += 4; |
51 | len += 4; |
45 | |
52 | |
46 | psiconv_progress(lev+2,off+len,"Going to read the list"); |
53 | psiconv_progress(lev+2,off+len,"Going to read the list"); |
47 | for (i = 0; i < listlen; i++) { |
54 | for (i = 0; i < listlen; i++) { |
48 | temp = psiconv_read_u32(buf,lev+2,off+len,&res); |
55 | temp = psiconv_read_u32(buf,lev+2,off+len,&res); |
49 | if (!res) |
56 | if (res) |
50 | goto ERROR2; |
57 | goto ERROR2; |
51 | if ((res = psiconv_list_add(*result,&temp))) |
58 | if ((res = psiconv_list_add(*result,&temp))) |
52 | goto ERROR2; |
59 | goto ERROR2; |
53 | psiconv_debug(lev+3,off+len,"Offset: %08x",temp); |
60 | psiconv_debug(lev+3,off+len,"Offset: %08x",temp); |
54 | len += 4; |
61 | len += 4; |
… | |
… | |
73 | else |
80 | else |
74 | return res; |
81 | return res; |
75 | } |
82 | } |
76 | |
83 | |
77 | static int decode_byte(int lev, psiconv_u32 off, |
84 | static int decode_byte(int lev, psiconv_u32 off, |
78 | psiconv_paint_data_section data, int *pixelnr, |
85 | psiconv_paint_data_section data, psiconv_u32 *pixelnr, |
79 | psiconv_u8 byte, int bits_per_pixel, int linelen, |
86 | psiconv_u8 byte, int bits_per_pixel, int linelen, |
80 | int *linepos,int picsize) |
87 | int *linepos,int picsize) |
81 | { |
88 | { |
82 | int mask = (bits_per_pixel << 1) -1; |
89 | int mask = (bits_per_pixel << 1) -1; |
83 | int i; |
90 | int i; |