/[public]/psiconv/trunk/lib/psiconv/parse_image.c
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/parse_image.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 163 Revision 168
28#ifdef DMALLOC 28#ifdef DMALLOC
29#include <dmalloc.h> 29#include <dmalloc.h>
30#endif 30#endif
31 31
32 32
33int psiconv_parse_jumptable_section(const psiconv_buffer buf,int lev, 33int psiconv_parse_jumptable_section(const psiconv_config config,
34 const psiconv_buffer buf,int lev,
34 psiconv_u32 off, int *length, 35 psiconv_u32 off, int *length,
35 psiconv_jumptable_section *result) 36 psiconv_jumptable_section *result)
36{ 37{
37 int res = 0; 38 int res = 0;
38 int len = 0; 39 int len = 0;
39 psiconv_u32 listlen,temp; 40 psiconv_u32 listlen,temp;
40 int i; 41 int i;
41 42
42 psiconv_progress(lev+1,off+len,"Going to read the jumptable section"); 43 psiconv_progress(config,lev+1,off+len,"Going to read the jumptable section");
43 if (!((*result) = psiconv_list_new(sizeof(psiconv_u32)))) 44 if (!((*result) = psiconv_list_new(sizeof(psiconv_u32))))
44 goto ERROR1; 45 goto ERROR1;
45 46
46 psiconv_progress(lev+2,off+len,"Going to read the list length"); 47 psiconv_progress(config,lev+2,off+len,"Going to read the list length");
47 listlen = psiconv_read_u32(buf,lev+2,off+len,&res); 48 listlen = psiconv_read_u32(config,buf,lev+2,off+len,&res);
48 if (res) 49 if (res)
49 goto ERROR2; 50 goto ERROR2;
50 psiconv_debug(lev+2,off+len,"List length: %08x",listlen); 51 psiconv_debug(config,lev+2,off+len,"List length: %08x",listlen);
51 len += 4; 52 len += 4;
52 53
53 psiconv_progress(lev+2,off+len,"Going to read the list"); 54 psiconv_progress(config,lev+2,off+len,"Going to read the list");
54 for (i = 0; i < listlen; i++) { 55 for (i = 0; i < listlen; i++) {
55 temp = psiconv_read_u32(buf,lev+2,off+len,&res); 56 temp = psiconv_read_u32(config,buf,lev+2,off+len,&res);
56 if (res) 57 if (res)
57 goto ERROR2; 58 goto ERROR2;
58 if ((res = psiconv_list_add(*result,&temp))) 59 if ((res = psiconv_list_add(*result,&temp)))
59 goto ERROR2; 60 goto ERROR2;
60 psiconv_debug(lev+3,off+len,"Offset: %08x",temp); 61 psiconv_debug(config,lev+3,off+len,"Offset: %08x",temp);
61 len += 4; 62 len += 4;
62 } 63 }
63 64
64 if (length) 65 if (length)
65 *length = len; 66 *length = len;
66 67
67 psiconv_progress(lev+1,off+len-1,"End of jumptable section " 68 psiconv_progress(config,lev+1,off+len-1,"End of jumptable section "
68 "(total length: %08x)", len); 69 "(total length: %08x)", len);
69 70
70 return 0; 71 return 0;
71 72
72ERROR2: 73ERROR2:
73 psiconv_list_free(*result); 74 psiconv_list_free(*result);
74ERROR1: 75ERROR1:
75 psiconv_warn(lev+1,off,"Reading of Jumptable Section failed"); 76 psiconv_warn(config,lev+1,off,"Reading of Jumptable Section failed");
76 if (length) 77 if (length)
77 *length = 0; 78 *length = 0;
78 if (!res) 79 if (!res)
79 return -PSICONV_E_NOMEM; 80 return -PSICONV_E_NOMEM;
80 else 81 else
81 return res; 82 return res;
82} 83}
83 84
84static int decode_byte(int lev, psiconv_u32 off, 85static int decode_byte(const psiconv_config config, int lev, psiconv_u32 off,
85 psiconv_paint_data_section data, psiconv_u32 *pixelnr, 86 psiconv_paint_data_section data, psiconv_u32 *pixelnr,
86 psiconv_u8 byte, int bits_per_pixel, int linelen, 87 psiconv_u8 byte, int bits_per_pixel, int linelen,
87 int *linepos,int picsize) 88 int *linepos,int picsize)
88{ 89{
89 int mask = (bits_per_pixel << 1) -1; 90 int mask = (bits_per_pixel << 1) -1;
90 int i; 91 int i;
91 if (*linepos < (data->xsize + (8/bits_per_pixel) - 1) / (8/bits_per_pixel)) 92 if (*linepos < (data->xsize + (8/bits_per_pixel) - 1) / (8/bits_per_pixel))
92 for (i = 0; i < 8/bits_per_pixel; i ++) { 93 for (i = 0; i < 8/bits_per_pixel; i ++) {
93 if ((i != 0) && ((*pixelnr % (data->xsize)) == 0)) { 94 if ((i != 0) && ((*pixelnr % (data->xsize)) == 0)) {
94 psiconv_debug(lev+1,off,"Skipping padding: %02x",byte); 95 psiconv_debug(config,lev+1,off,"Skipping padding: %02x",byte);
95 i = 8; 96 i = 8;
96 } else if (*pixelnr >= picsize) { 97 } else if (*pixelnr >= picsize) {
97 psiconv_warn(lev+1,off,"Corrupted picture data!"); 98 psiconv_warn(config,lev+1,off,"Corrupted picture data!");
98 psiconv_debug(lev+1,off,"Trying to write a pixel too far"); 99 psiconv_debug(config,lev+1,off,"Trying to write a pixel too far");
99 return -1; 100 return -1;
100 } else { 101 } else {
101 data->red[*pixelnr] = data->green[*pixelnr] = data->blue[*pixelnr] = 102 data->red[*pixelnr] = data->green[*pixelnr] = data->blue[*pixelnr] =
102 ((float) (byte & mask)) / ((1 << bits_per_pixel) -1); 103 ((float) (byte & mask)) / ((1 << bits_per_pixel) -1);
103 psiconv_debug(lev+1,off,"Pixel %04x: (%04x,%04x) value %02x, color %f", 104 psiconv_debug(config,lev+1,off,"Pixel %04x: (%04x,%04x) value %02x, color %f",
104 *pixelnr,*pixelnr % data->xsize, 105 *pixelnr,*pixelnr % data->xsize,
105 *pixelnr / data->xsize, byte&mask, data->red[*pixelnr]); 106 *pixelnr / data->xsize, byte&mask, data->red[*pixelnr]);
106 byte = byte >> bits_per_pixel; 107 byte = byte >> bits_per_pixel;
107 (*pixelnr) ++; 108 (*pixelnr) ++;
108 } 109 }
109 } 110 }
110 else 111 else
111 psiconv_debug(lev+1,off,"Skipping padding byte"); 112 psiconv_debug(config,lev+1,off,"Skipping padding byte");
112 (*linepos) ++; 113 (*linepos) ++;
113 if (*linepos == linelen) 114 if (*linepos == linelen)
114 *linepos = 0; 115 *linepos = 0;
115 return 0; 116 return 0;
116} 117}
117 118
118 119
119int psiconv_parse_paint_data_section(const psiconv_buffer buf,int lev, 120int psiconv_parse_paint_data_section(const psiconv_config config,
121 const psiconv_buffer buf,int lev,
120 psiconv_u32 off, int *length,int isclipart, 122 psiconv_u32 off, int *length,int isclipart,
121 psiconv_paint_data_section *result) 123 psiconv_paint_data_section *result)
122{ 124{
123 int res = 0; 125 int res = 0;
124 int len = 0; 126 int len = 0;
126 psiconv_u8 marker; 128 psiconv_u8 marker;
127 int i,leng; 129 int i,leng;
128 psiconv_u32 bits_per_pixel,compression; 130 psiconv_u32 bits_per_pixel,compression;
129 int linepos = 0; 131 int linepos = 0;
130 132
131 psiconv_progress(lev+1,off,"Going to read a paint data section"); 133 psiconv_progress(config,lev+1,off,"Going to read a paint data section");
132 if (!((*result) = malloc(sizeof(**result)))) 134 if (!((*result) = malloc(sizeof(**result))))
133 goto ERROR1; 135 goto ERROR1;
134 136
135 psiconv_progress(lev+2,off+len,"Going to read section size"); 137 psiconv_progress(config,lev+2,off+len,"Going to read section size");
136 size = psiconv_read_u32(buf,lev+2,off+len,&res); 138 size = psiconv_read_u32(config,buf,lev+2,off+len,&res);
137 if (res) 139 if (res)
138 goto ERROR2; 140 goto ERROR2;
139 psiconv_debug(lev+2,off+len,"Section size: %08x",size); 141 psiconv_debug(config,lev+2,off+len,"Section size: %08x",size);
140 len += 4; 142 len += 4;
141 143
142 psiconv_progress(lev+2,off+len,"Going to read pixel data offset"); 144 psiconv_progress(config,lev+2,off+len,"Going to read pixel data offset");
143 offset = psiconv_read_u32(buf,lev+2,off+len,&res); 145 offset = psiconv_read_u32(config,buf,lev+2,off+len,&res);
144 if (res) 146 if (res)
145 goto ERROR2; 147 goto ERROR2;
146 if (offset != 0x28) { 148 if (offset != 0x28) {
147 psiconv_warn(lev+2,off+len, 149 psiconv_warn(config,lev+2,off+len,
148 "Paint data section data offset has unexpected value"); 150 "Paint data section data offset has unexpected value");
149 psiconv_debug(lev+2,off+len, 151 psiconv_debug(config,lev+2,off+len,
150 "Data offset: read %08x, expected %08x",offset,0x28); 152 "Data offset: read %08x, expected %08x",offset,0x28);
151 res = -1; 153 res = -1;
152 } 154 }
153 len += 4; 155 len += 4;
154 156
155 psiconv_progress(lev+2,off+len,"Going to read picture X size"); 157 psiconv_progress(config,lev+2,off+len,"Going to read picture X size");
156 (*result)->xsize = psiconv_read_u32(buf,lev+2,off+len,&res); 158 (*result)->xsize = psiconv_read_u32(config,buf,lev+2,off+len,&res);
157 if (res) 159 if (res)
158 goto ERROR2; 160 goto ERROR2;
159 psiconv_debug(lev+2,off+len,"Picture X size: %08x:",(*result)->xsize); 161 psiconv_debug(config,lev+2,off+len,"Picture X size: %08x:",(*result)->xsize);
160 len += 4; 162 len += 4;
161 163
162 psiconv_progress(lev+2,off+len,"Going to read picture Y size"); 164 psiconv_progress(config,lev+2,off+len,"Going to read picture Y size");
163 (*result)->ysize = psiconv_read_u32(buf,lev+2,off+len,&res); 165 (*result)->ysize = psiconv_read_u32(config,buf,lev+2,off+len,&res);
164 if (res) 166 if (res)
165 goto ERROR2; 167 goto ERROR2;
166 psiconv_debug(lev+2,off+len,"Picture Y size: %08x:",(*result)->ysize); 168 psiconv_debug(config,lev+2,off+len,"Picture Y size: %08x:",(*result)->ysize);
167 len += 4; 169 len += 4;
168 170
169 picsize = (*result)->ysize * (*result)->xsize; 171 picsize = (*result)->ysize * (*result)->xsize;
170 172
171 psiconv_progress(lev+2,off+len,"Going to read the real picture x size"); 173 psiconv_progress(config,lev+2,off+len,"Going to read the real picture x size");
172 (*result)->pic_xsize = psiconv_read_length(buf,lev+2,off+len,&leng,&res); 174 (*result)->pic_xsize = psiconv_read_length(config,buf,lev+2,off+len,&leng,&res);
173 if (res) 175 if (res)
174 goto ERROR2; 176 goto ERROR2;
175 psiconv_debug(lev+2,off+len,"Picture x size: %f",(*result)->pic_xsize); 177 psiconv_debug(config,lev+2,off+len,"Picture x size: %f",(*result)->pic_xsize);
176 len += leng; 178 len += leng;
177 179
178 psiconv_progress(lev+2,off+len,"Going to read the real picture y size"); 180 psiconv_progress(config,lev+2,off+len,"Going to read the real picture y size");
179 (*result)->pic_ysize = psiconv_read_length(buf,lev+2,off+len,&leng,&res); 181 (*result)->pic_ysize = psiconv_read_length(config,buf,lev+2,off+len,&leng,&res);
180 if (res) 182 if (res)
181 goto ERROR2; 183 goto ERROR2;
182 psiconv_debug(lev+2,off+len,"Picture y size: %f",(*result)->pic_ysize); 184 psiconv_debug(config,lev+2,off+len,"Picture y size: %f",(*result)->pic_ysize);
183 len += leng; 185 len += leng;
184 186
185 psiconv_progress(lev+2,off+len,"Going to read the number of bits per pixel"); 187 psiconv_progress(config,lev+2,off+len,"Going to read the number of bits per pixel");
186 bits_per_pixel=psiconv_read_u32(buf,lev+2,off+len,&res); 188 bits_per_pixel=psiconv_read_u32(config,buf,lev+2,off+len,&res);
187 if (res) 189 if (res)
188 goto ERROR2; 190 goto ERROR2;
189 if (bits_per_pixel > 8) { 191 if (bits_per_pixel > 8) {
190 psiconv_warn(lev+2,off+len,"Picture has too many colors"); 192 psiconv_warn(config,lev+2,off+len,"Picture has too many colors");
191 psiconv_debug(lev+2,off+len,"Read %d colorbits",bits_per_pixel); 193 psiconv_debug(config,lev+2,off+len,"Read %d colorbits",bits_per_pixel);
192 res = -PSICONV_E_PARSE; 194 res = -PSICONV_E_PARSE;
193 goto ERROR2; 195 goto ERROR2;
194 } 196 }
195 psiconv_debug(lev+2,off+len,"Bits per pixel: %d",bits_per_pixel); 197 psiconv_debug(config,lev+2,off+len,"Bits per pixel: %d",bits_per_pixel);
196 len += 4; 198 len += 4;
197 199
198 for (i = 0 ; i < 2; i++) { 200 for (i = 0 ; i < 2; i++) {
199 temp = psiconv_read_u32(buf,lev+2,off+len,&res); 201 temp = psiconv_read_u32(config,buf,lev+2,off+len,&res);
200 if (res) 202 if (res)
201 goto ERROR2; 203 goto ERROR2;
202 if (temp != 00) { 204 if (temp != 00) {
203 psiconv_warn(lev+2,off+len, 205 psiconv_warn(config,lev+2,off+len,
204 "Paint data section prologue has unknown values (ignored)"); 206 "Paint data section prologue has unknown values (ignored)");
205 psiconv_debug(lev+2,off+len, 207 psiconv_debug(config,lev+2,off+len,
206 "offset %02x: read %08x, expected %08x",i,temp, 0x00); 208 "offset %02x: read %08x, expected %08x",i,temp, 0x00);
207 } 209 }
208 len += 4; 210 len += 4;
209 } 211 }
210 212
211 psiconv_progress(lev+2,off+len, 213 psiconv_progress(config,lev+2,off+len,
212 "Going to read whether RLE compression is used"); 214 "Going to read whether RLE compression is used");
213 compression=psiconv_read_u32(buf,lev+2,off+len,&res); 215 compression=psiconv_read_u32(config,buf,lev+2,off+len,&res);
214 if (res) 216 if (res)
215 goto ERROR2; 217 goto ERROR2;
216 if (compression > 1) { 218 if (compression > 1) {
217 psiconv_warn(lev+2,off+len,"Paint data section has unknown " 219 psiconv_warn(config,lev+2,off+len,"Paint data section has unknown "
218 "compression type, assuming RLE"); 220 "compression type, assuming RLE");
219 psiconv_debug(lev+2,off+len,"Read compression type %d",compression); 221 psiconv_debug(config,lev+2,off+len,"Read compression type %d",compression);
220 compression = 1; 222 compression = 1;
221 } 223 }
222 psiconv_debug(lev+2,off+len,"Compression: %s",compression?"RLE":"none"); 224 psiconv_debug(config,lev+2,off+len,"Compression: %s",compression?"RLE":"none");
223 len += 4; 225 len += 4;
224 226
225 if (isclipart) { 227 if (isclipart) {
226 psiconv_progress(lev+2,off+len,"Going to read an unknown long"); 228 psiconv_progress(config,lev+2,off+len,"Going to read an unknown long");
227 temp = psiconv_read_u32(buf,lev+2,off+len,&res); 229 temp = psiconv_read_u32(config,buf,lev+2,off+len,&res);
228 if (res) 230 if (res)
229 goto ERROR2; 231 goto ERROR2;
230 if (temp != 0xffffffff) { 232 if (temp != 0xffffffff) {
231 psiconv_warn(lev+2,off+len, 233 psiconv_warn(config,lev+2,off+len,
232 "Paint data section prologue has unknown values (ignoring)"); 234 "Paint data section prologue has unknown values (ignoring)");
233 psiconv_debug(lev+2,off+len, 235 psiconv_debug(config,lev+2,off+len,
234 "offset %02x: read %08x, expected %08x",i,temp, 0xffffffff); 236 "offset %02x: read %08x, expected %08x",i,temp, 0xffffffff);
235 } 237 }
236 len += 4; 238 len += 4;
237 psiconv_progress(lev+2,off+len,"Going to read a second unknown long"); 239 psiconv_progress(config,lev+2,off+len,"Going to read a second unknown long");
238 temp = psiconv_read_u32(buf,lev+2,off+len,&res); 240 temp = psiconv_read_u32(config,buf,lev+2,off+len,&res);
239 if (res) 241 if (res)
240 goto ERROR2; 242 goto ERROR2;
241 if (temp != 0x44) { 243 if (temp != 0x44) {
242 psiconv_warn(lev+2,off+len, 244 psiconv_warn(config,lev+2,off+len,
243 "Paint data section prologue has unknown values (ignoring)"); 245 "Paint data section prologue has unknown values (ignoring)");
244 psiconv_debug(lev+2,off+len, 246 psiconv_debug(config,lev+2,off+len,
245 "offset %02x: read %08x, expected %08x",i,temp, 0x44); 247 "offset %02x: read %08x, expected %08x",i,temp, 0x44);
246 } 248 }
247 len += 4; 249 len += 4;
248 } 250 }
249 251
256 len = offset; 258 len = offset;
257 datasize = size - len; 259 datasize = size - len;
258 if (isclipart) 260 if (isclipart)
259 len += 8; 261 len += 8;
260 262
261 psiconv_progress(lev+2,off+len,"Going to read the pixel data"); 263 psiconv_progress(config,lev+2,off+len,"Going to read the pixel data");
262 pixelnr = 0; 264 pixelnr = 0;
263 datanr = 0; 265 datanr = 0;
264 if (!compression) { 266 if (!compression) {
265 linelen = datasize / (*result)->ysize; 267 linelen = datasize / (*result)->ysize;
266 psiconv_debug(lev+3,off+len,"Line length: %04x bytes",linelen); 268 psiconv_debug(config,lev+3,off+len,"Line length: %04x bytes",linelen);
267 while((datanr < datasize)) { 269 while((datanr < datasize)) {
268 temp = psiconv_read_u8(buf,lev+2,off+len+datanr,&res); 270 temp = psiconv_read_u8(config,buf,lev+2,off+len+datanr,&res);
269 if (res) 271 if (res)
270 goto ERROR5; 272 goto ERROR5;
271 if (decode_byte(lev+3,off+len+datanr,*result,&pixelnr,temp,bits_per_pixel, 273 if (decode_byte(config,lev+3,off+len+datanr,*result,&pixelnr,temp,bits_per_pixel,
272 linelen,&linepos,picsize)) { 274 linelen,&linepos,picsize)) {
273 res = -PSICONV_E_PARSE; 275 res = -PSICONV_E_PARSE;
274 break; 276 break;
275 } 277 }
276 datanr++; 278 datanr++;
277 } 279 }
278 } else { 280 } else {
279 psiconv_progress(lev+2,off+len,"First pass: determining line length"); 281 psiconv_progress(config,lev+2,off+len,"First pass: determining line length");
280 datanr = 0; 282 datanr = 0;
281 i = 0; 283 i = 0;
282 while (datanr < datasize) { 284 while (datanr < datasize) {
283 marker = psiconv_read_u8(buf,lev+3,off+len+datanr,&res); 285 marker = psiconv_read_u8(config,buf,lev+3,off+len+datanr,&res);
284 if (res) 286 if (res)
285 goto ERROR5; 287 goto ERROR5;
286 if (marker >= 0x80) { 288 if (marker >= 0x80) {
287 datanr += 0x100 - marker + 1; 289 datanr += 0x100 - marker + 1;
288 i += 0x100 - marker; 290 i += 0x100 - marker;
291 i += marker + 1; 293 i += marker + 1;
292 } 294 }
293 } 295 }
294 linelen = i / (*result)->ysize; 296 linelen = i / (*result)->ysize;
295 datanr=0; 297 datanr=0;
296 psiconv_debug(lev+2,off+len,"Linelen: %04x bytes",linelen); 298 psiconv_debug(config,lev+2,off+len,"Linelen: %04x bytes",linelen);
297 while((datanr < datasize)) { 299 while((datanr < datasize)) {
298 marker = psiconv_read_u8(buf,lev+3,off+len+datanr,&res); 300 marker = psiconv_read_u8(config,buf,lev+3,off+len+datanr,&res);
299 if (res) 301 if (res)
300 goto ERROR5; 302 goto ERROR5;
301 psiconv_debug(lev+3,off+len+datanr, 303 psiconv_debug(config,lev+3,off+len+datanr,
302 "Pixelnr %08x, Datanr %08x: Read marker %02x", 304 "Pixelnr %08x, Datanr %08x: Read marker %02x",
303 pixelnr,datanr,marker); 305 pixelnr,datanr,marker);
304 datanr ++; 306 datanr ++;
305 if (marker >= 0x80) { 307 if (marker >= 0x80) {
306 /* 0x100 - marker bytes of data follow */ 308 /* 0x100 - marker bytes of data follow */
307 for (i = 0; i < 0x100-marker; i++,datanr++) { 309 for (i = 0; i < 0x100-marker; i++,datanr++) {
308 if (datanr >= datasize) { 310 if (datanr >= datasize) {
309 psiconv_warn(lev+3,off+len+datanr,"Corrupted picture data"); 311 psiconv_warn(config,lev+3,off+len+datanr,"Corrupted picture data");
310 psiconv_debug(lev+3,off+len+datanr, 312 psiconv_debug(config,lev+3,off+len+datanr,
311 "Picsize: %08x, Datasize: %08x, Pixelnr: %08x," 313 "Picsize: %08x, Datasize: %08x, Pixelnr: %08x,"
312 "Datanr: %08x, marker: %02x",picsize,datasize,pixelnr, 314 "Datanr: %08x, marker: %02x",picsize,datasize,pixelnr,
313 datanr,marker); 315 datanr,marker);
314 res = -PSICONV_E_PARSE; 316 res = -PSICONV_E_PARSE;
315 break; 317 break;
316 } 318 }
317 temp = psiconv_read_u8(buf,lev+2,off+len+datanr,&res); 319 temp = psiconv_read_u8(config,buf,lev+2,off+len+datanr,&res);
318 if (res) 320 if (res)
319 goto ERROR5; 321 goto ERROR5;
320 if (decode_byte(lev+2,off+len+datanr,*result,&pixelnr,temp, 322 if (decode_byte(config,lev+2,off+len+datanr,*result,&pixelnr,temp,
321 bits_per_pixel,linelen,&linepos,picsize)) { 323 bits_per_pixel,linelen,&linepos,picsize)) {
322 res = -PSICONV_E_PARSE; 324 res = -PSICONV_E_PARSE;
323 break; 325 break;
324 } 326 }
325 } 327 }
326 } else { 328 } else {
327 if (datanr >= datasize) { 329 if (datanr >= datasize) {
328 psiconv_warn(lev+3,off+len+datanr,"Corrupted picture data"); 330 psiconv_warn(config,lev+3,off+len+datanr,"Corrupted picture data");
329 psiconv_debug(lev+3,off+len+datanr, 331 psiconv_debug(config,lev+3,off+len+datanr,
330 "Picsize: %08x, Datasize: %08x, Pixelnr: %08x," 332 "Picsize: %08x, Datasize: %08x, Pixelnr: %08x,"
331 "Datanr: %08x, marker: %02x",picsize,datasize,pixelnr, 333 "Datanr: %08x, marker: %02x",picsize,datasize,pixelnr,
332 datanr,marker); 334 datanr,marker);
333 res = -PSICONV_E_PARSE; 335 res = -PSICONV_E_PARSE;
334 } else { 336 } else {
335 temp = psiconv_read_u8(buf,lev+3,off+len+datanr,&res); 337 temp = psiconv_read_u8(config,buf,lev+3,off+len+datanr,&res);
336 if (res) 338 if (res)
337 goto ERROR5; 339 goto ERROR5;
338 for (i = 0; i <= marker; i++) { 340 for (i = 0; i <= marker; i++) {
339 if (decode_byte(lev+2,off+len+datanr,*result,&pixelnr,temp, 341 if (decode_byte(config,lev+2,off+len+datanr,*result,&pixelnr,temp,
340 bits_per_pixel,linelen,&linepos,picsize)) { 342 bits_per_pixel,linelen,&linepos,picsize)) {
341 res = -PSICONV_E_PARSE; 343 res = -PSICONV_E_PARSE;
342 break; 344 break;
343 } 345 }
344 } 346 }
351 if (linepos >= ((*result)->xsize + (8/bits_per_pixel) - 1) / 353 if (linepos >= ((*result)->xsize + (8/bits_per_pixel) - 1) /
352 (8/bits_per_pixel)) 354 (8/bits_per_pixel))
353 datanr += (linelen - linepos); 355 datanr += (linelen - linepos);
354 356
355 if (res || (datanr != datasize) || (pixelnr != picsize)) { 357 if (res || (datanr != datasize) || (pixelnr != picsize)) {
356 psiconv_warn(lev+2,off+len,"Corrupted picture data!"); 358 psiconv_warn(config,lev+2,off+len,"Corrupted picture data!");
357 psiconv_debug(lev+3,off+len+datanr, 359 psiconv_debug(config,lev+3,off+len+datanr,
358 "Picsize: %08x, Datasize: %08x, Pixelnr: %08x," 360 "Picsize: %08x, Datasize: %08x, Pixelnr: %08x,"
359 "Datanr: %08x",picsize,datasize,pixelnr,datanr); 361 "Datanr: %08x",picsize,datasize,pixelnr,datanr);
360 goto ERROR5; 362 goto ERROR5;
361 } 363 }
362 364
363 len += datanr; 365 len += datanr;
364 366
365 if (length) 367 if (length)
366 *length = len; 368 *length = len;
367 369
368 psiconv_progress(lev+1,off+len-1,"End of paint data section " 370 psiconv_progress(config,lev+1,off+len-1,"End of paint data section "
369 "(total length: %08x)", len); 371 "(total length: %08x)", len);
370 372
371 return res; 373 return res;
372 374
373ERROR5: 375ERROR5:
377ERROR3: 379ERROR3:
378 free((*result)->red); 380 free((*result)->red);
379ERROR2: 381ERROR2:
380 free (*result); 382 free (*result);
381ERROR1: 383ERROR1:
382 psiconv_warn(lev+1,off,"Reading of Paint Data Section failed"); 384 psiconv_warn(config,lev+1,off,"Reading of Paint Data Section failed");
383 if (length) 385 if (length)
384 *length = 0; 386 *length = 0;
385 if (!res) 387 if (!res)
386 return -PSICONV_E_NOMEM; 388 return -PSICONV_E_NOMEM;
387 else 389 else
388 return res; 390 return res;
389} 391}
390 392
391int psiconv_parse_sketch_section(const psiconv_buffer buf, int lev, 393int psiconv_parse_sketch_section(const psiconv_config config,
394 const psiconv_buffer buf, int lev,
392 psiconv_u32 off, int *length, 395 psiconv_u32 off, int *length,
393 psiconv_sketch_section *result) 396 psiconv_sketch_section *result)
394{ 397{
395 int res=0; 398 int res=0;
396 int len=0; 399 int len=0;
397 psiconv_u32 temp; 400 psiconv_u32 temp;
398 int leng; 401 int leng;
399 402
400 psiconv_progress(lev+1,off,"Going to read the sketch section"); 403 psiconv_progress(config,lev+1,off,"Going to read the sketch section");
401 if (!(*result = malloc(sizeof(**result)))) 404 if (!(*result = malloc(sizeof(**result))))
402 goto ERROR1; 405 goto ERROR1;
403 406
404 psiconv_progress(lev+2,off+len,"Going to read the displayed hor. size"); 407 psiconv_progress(config,lev+2,off+len,"Going to read the displayed hor. size");
405 (*result)->displayed_xsize = psiconv_read_u16(buf,lev+2,off + len,&res); 408 (*result)->displayed_xsize = psiconv_read_u16(config,buf,lev+2,off + len,&res);
406 if (res) 409 if (res)
407 goto ERROR2; 410 goto ERROR2;
408 psiconv_debug(lev+2,off+len,"Displayed hor. size: %04x", 411 psiconv_debug(config,lev+2,off+len,"Displayed hor. size: %04x",
409 (*result)->displayed_xsize); 412 (*result)->displayed_xsize);
410 len += 0x02; 413 len += 0x02;
411 psiconv_progress(lev+2,off+len,"Going to read displayed ver. size"); 414 psiconv_progress(config,lev+2,off+len,"Going to read displayed ver. size");
412 (*result)->displayed_ysize = psiconv_read_u16(buf,lev+2,off + len,&res); 415 (*result)->displayed_ysize = psiconv_read_u16(config,buf,lev+2,off + len,&res);
413 if (res) 416 if (res)
414 goto ERROR2; 417 goto ERROR2;
415 psiconv_debug(lev+2,off+len,"Displayed ver. size: %04x", 418 psiconv_debug(config,lev+2,off+len,"Displayed ver. size: %04x",
416 (*result)->displayed_ysize); 419 (*result)->displayed_ysize);
417 len += 0x02; 420 len += 0x02;
418 421
419 psiconv_progress(lev+2,off+len,"Going to read the data hor. offset"); 422 psiconv_progress(config,lev+2,off+len,"Going to read the data hor. offset");
420 (*result)->picture_data_x_offset = psiconv_read_u16(buf,lev+2,off + len, 423 (*result)->picture_data_x_offset = psiconv_read_u16(config,buf,lev+2,off + len,
421 &res); 424 &res);
422 if (res) 425 if (res)
423 goto ERROR2; 426 goto ERROR2;
424 psiconv_debug(lev+2,off+len,"Data hor. offset: %04x", 427 psiconv_debug(config,lev+2,off+len,"Data hor. offset: %04x",
425 (*result)->picture_data_x_offset); 428 (*result)->picture_data_x_offset);
426 len += 0x02; 429 len += 0x02;
427 psiconv_progress(lev+2,off+len,"Going to read the data ver. offset"); 430 psiconv_progress(config,lev+2,off+len,"Going to read the data ver. offset");
428 (*result)->picture_data_y_offset = psiconv_read_u16(buf,lev+2,off + len, 431 (*result)->picture_data_y_offset = psiconv_read_u16(config,buf,lev+2,off + len,
429 &res); 432 &res);
430 if (res) 433 if (res)
431 goto ERROR2; 434 goto ERROR2;
432 psiconv_debug(lev+2,off+len,"Data ver. offset: %04x", 435 psiconv_debug(config,lev+2,off+len,"Data ver. offset: %04x",
433 (*result)->picture_data_y_offset); 436 (*result)->picture_data_y_offset);
434 len += 0x02; 437 len += 0x02;
435 438
436 psiconv_progress(lev+2,off+len,"Going to read the displayed hor. offset"); 439 psiconv_progress(config,lev+2,off+len,"Going to read the displayed hor. offset");
437 (*result)->displayed_size_x_offset = psiconv_read_u16(buf,lev+2,off + len, 440 (*result)->displayed_size_x_offset = psiconv_read_u16(config,buf,lev+2,off + len,
438 &res); 441 &res);
439 if (res) 442 if (res)
440 goto ERROR2; 443 goto ERROR2;
441 psiconv_debug(lev+2,off+len,"Displayed hor. offset: %04x", 444 psiconv_debug(config,lev+2,off+len,"Displayed hor. offset: %04x",
442 (*result)->displayed_size_x_offset); 445 (*result)->displayed_size_x_offset);
443 len += 0x02; 446 len += 0x02;
444 psiconv_progress(lev+2,off+len,"Going to read the displayed ver. offset"); 447 psiconv_progress(config,lev+2,off+len,"Going to read the displayed ver. offset");
445 (*result)->displayed_size_y_offset = psiconv_read_u16(buf,lev+2,off + len, 448 (*result)->displayed_size_y_offset = psiconv_read_u16(config,buf,lev+2,off + len,
446 &res); 449 &res);
447 if (res) 450 if (res)
448 goto ERROR2; 451 goto ERROR2;
449 psiconv_debug(lev+2,off+len,"Displayed ver. offset: %04x", 452 psiconv_debug(config,lev+2,off+len,"Displayed ver. offset: %04x",
450 (*result)->displayed_size_y_offset); 453 (*result)->displayed_size_y_offset);
451 len += 0x02; 454 len += 0x02;
452 455
453 psiconv_progress(lev+2,off+len,"Going to read the form hor. size"); 456 psiconv_progress(config,lev+2,off+len,"Going to read the form hor. size");
454 (*result)->form_xsize = psiconv_read_u16(buf,lev+2,off + len,&res); 457 (*result)->form_xsize = psiconv_read_u16(config,buf,lev+2,off + len,&res);
455 if (res) 458 if (res)
456 goto ERROR2; 459 goto ERROR2;
457 psiconv_debug(lev+2,off+len,"Form hor. size: %04x", 460 psiconv_debug(config,lev+2,off+len,"Form hor. size: %04x",
458 (*result)->form_xsize); 461 (*result)->form_xsize);
459 len += 0x02; 462 len += 0x02;
460 psiconv_progress(lev+2,off+len,"Going to read form ver. size"); 463 psiconv_progress(config,lev+2,off+len,"Going to read form ver. size");
461 (*result)->form_ysize = psiconv_read_u16(buf,lev+2,off + len,&res); 464 (*result)->form_ysize = psiconv_read_u16(config,buf,lev+2,off + len,&res);
462 if (res) 465 if (res)
463 goto ERROR2; 466 goto ERROR2;
464 psiconv_debug(lev+2,off+len,"Form ver. size: %04x", 467 psiconv_debug(config,lev+2,off+len,"Form ver. size: %04x",
465 (*result)->form_ysize); 468 (*result)->form_ysize);
466 len += 0x02; 469 len += 0x02;
467 470
468 psiconv_progress(lev+2,off+len,"Going to skip 1 word of zeros"); 471 psiconv_progress(config,lev+2,off+len,"Going to skip 1 word of zeros");
469 temp = psiconv_read_u16(buf,lev+2,off+len,&res); 472 temp = psiconv_read_u16(config,buf,lev+2,off+len,&res);
470 if (res) 473 if (res)
471 goto ERROR2; 474 goto ERROR2;
472 if (temp != 0) { 475 if (temp != 0) {
473 psiconv_warn(lev+2,off+len, 476 psiconv_warn(config,lev+2,off+len,
474 "Unexpected value in sketch section preamble (ignored)"); 477 "Unexpected value in sketch section preamble (ignored)");
475 psiconv_debug(lev+2,off+len,"Read %04x, expected %04x", 478 psiconv_debug(config,lev+2,off+len,"Read %04x, expected %04x",
476 temp,0); 479 temp,0);
477 } 480 }
478 off += 0x02; 481 off += 0x02;
479 482
480 psiconv_progress(lev+2,off+len,"Going to read the picture data"); 483 psiconv_progress(config,lev+2,off+len,"Going to read the picture data");
481 if ((res = psiconv_parse_paint_data_section(buf,lev+2,off+len,&leng,0, 484 if ((res = psiconv_parse_paint_data_section(config,buf,lev+2,off+len,&leng,0,
482 &((*result)->picture)))) 485 &((*result)->picture))))
483 goto ERROR2; 486 goto ERROR2;
484 off += leng; 487 off += leng;
485 488
486 psiconv_progress(lev+2,off+len,"Going to read the hor. magnification"); 489 psiconv_progress(config,lev+2,off+len,"Going to read the hor. magnification");
487 (*result)->magnification_x = psiconv_read_u16(buf,lev+2,off+len,&res)/1000.0; 490 (*result)->magnification_x = psiconv_read_u16(config,buf,lev+2,off+len,&res)/1000.0;
488 if (res) 491 if (res)
489 goto ERROR3; 492 goto ERROR3;
490 psiconv_debug(lev+2,off+len,"Form hor. magnification: %f", 493 psiconv_debug(config,lev+2,off+len,"Form hor. magnification: %f",
491 (*result)->magnification_x); 494 (*result)->magnification_x);
492 len += 0x02; 495 len += 0x02;
493 psiconv_progress(lev+2,off+len,"Going to read the ver. magnification"); 496 psiconv_progress(config,lev+2,off+len,"Going to read the ver. magnification");
494 (*result)->magnification_y = psiconv_read_u16(buf,lev+2,off+len,&res)/1000.0; 497 (*result)->magnification_y = psiconv_read_u16(config,buf,lev+2,off+len,&res)/1000.0;
495 if (res) 498 if (res)
496 goto ERROR3; 499 goto ERROR3;
497 psiconv_debug(lev+2,off+len,"Form ver. magnification: %f", 500 psiconv_debug(config,lev+2,off+len,"Form ver. magnification: %f",
498 (*result)->magnification_y); 501 (*result)->magnification_y);
499 len += 0x02; 502 len += 0x02;
500 503
501 psiconv_progress(lev+2,off+len,"Going to read the left cut"); 504 psiconv_progress(config,lev+2,off+len,"Going to read the left cut");
502 temp = psiconv_read_u32(buf,lev+2,off + len,&res); 505 temp = psiconv_read_u32(config,buf,lev+2,off + len,&res);
503 if (res) 506 if (res)
504 goto ERROR3; 507 goto ERROR3;
505 (*result)->cut_left = (temp * 6.0) / (*result)->displayed_xsize; 508 (*result)->cut_left = (temp * 6.0) / (*result)->displayed_xsize;
506 psiconv_debug(lev+2,off+len,"Left cut: raw %08x, real: %f", 509 psiconv_debug(config,lev+2,off+len,"Left cut: raw %08x, real: %f",
507 temp,(*result)->cut_left); 510 temp,(*result)->cut_left);
508 len += 0x04; 511 len += 0x04;
509 psiconv_progress(lev+2,off+len,"Going to read the right cut"); 512 psiconv_progress(config,lev+2,off+len,"Going to read the right cut");
510 temp = psiconv_read_u32(buf,lev+2,off + len,&res); 513 temp = psiconv_read_u32(config,buf,lev+2,off + len,&res);
511 if (res) 514 if (res)
512 goto ERROR3; 515 goto ERROR3;
513 (*result)->cut_right = (temp * 6.0) / (*result)->displayed_xsize; 516 (*result)->cut_right = (temp * 6.0) / (*result)->displayed_xsize;
514 psiconv_debug(lev+2,off+len,"Right cut: raw %08x, real: %f", 517 psiconv_debug(config,lev+2,off+len,"Right cut: raw %08x, real: %f",
515 temp,(*result)->cut_right); 518 temp,(*result)->cut_right);
516 len += 0x04; 519 len += 0x04;
517 psiconv_progress(lev+2,off+len,"Going to read the top cut"); 520 psiconv_progress(config,lev+2,off+len,"Going to read the top cut");
518 temp = psiconv_read_u32(buf,lev+2,off + len,&res); 521 temp = psiconv_read_u32(config,buf,lev+2,off + len,&res);
519 if (res) 522 if (res)
520 goto ERROR3; 523 goto ERROR3;
521 (*result)->cut_top = (temp * 6.0) / (*result)->displayed_ysize; 524 (*result)->cut_top = (temp * 6.0) / (*result)->displayed_ysize;
522 psiconv_debug(lev+2,off+len,"Top cut: raw %08x, real: %f", 525 psiconv_debug(config,lev+2,off+len,"Top cut: raw %08x, real: %f",
523 temp,(*result)->cut_top); 526 temp,(*result)->cut_top);
524 len += 0x04; 527 len += 0x04;
525 psiconv_progress(lev+2,off+len,"Going to read the bottom cut"); 528 psiconv_progress(config,lev+2,off+len,"Going to read the bottom cut");
526 temp = psiconv_read_u32(buf,lev+2,off + len,&res); 529 temp = psiconv_read_u32(config,buf,lev+2,off + len,&res);
527 if (res) 530 if (res)
528 goto ERROR3; 531 goto ERROR3;
529 (*result)->cut_bottom = (temp * 6.0) / (*result)->displayed_ysize; 532 (*result)->cut_bottom = (temp * 6.0) / (*result)->displayed_ysize;
530 psiconv_debug(lev+2,off+len,"Bottom cut: raw %08x, real: %f", 533 psiconv_debug(config,lev+2,off+len,"Bottom cut: raw %08x, real: %f",
531 temp,(*result)->cut_bottom); 534 temp,(*result)->cut_bottom);
532 len += 0x04; 535 len += 0x04;
533 536
534 if (length) 537 if (length)
535 *length = len; 538 *length = len;
536 539
537 psiconv_progress(lev,off+len-1, 540 psiconv_progress(config,lev,off+len-1,
538 "End of sketch section (total length: %08x)", len); 541 "End of sketch section (total length: %08x)", len);
539 542
540 return res; 543 return res;
541ERROR3: 544ERROR3:
542 psiconv_free_paint_data_section((*result)->picture); 545 psiconv_free_paint_data_section((*result)->picture);
543ERROR2: 546ERROR2:
544 free (*result); 547 free (*result);
545ERROR1: 548ERROR1:
546 psiconv_warn(lev+1,off,"Reading of Sketch Section failed"); 549 psiconv_warn(config,lev+1,off,"Reading of Sketch Section failed");
547 if (length) 550 if (length)
548 *length = 0; 551 *length = 0;
549 if (!res) 552 if (!res)
550 return -PSICONV_E_NOMEM; 553 return -PSICONV_E_NOMEM;
551 else 554 else
552 return res; 555 return res;
553} 556}
554 557
555 558
556int psiconv_parse_clipart_section(const psiconv_buffer buf,int lev, 559int psiconv_parse_clipart_section(const psiconv_config config,
560 const psiconv_buffer buf,int lev,
557 psiconv_u32 off, int *length, 561 psiconv_u32 off, int *length,
558 psiconv_clipart_section *result) 562 psiconv_clipart_section *result)
559{ 563{
560 int res=0; 564 int res=0;
561 int len=0; 565 int len=0;
562 int leng; 566 int leng;
563 psiconv_u32 temp; 567 psiconv_u32 temp;
564 568
565 psiconv_progress(lev+1,off+len,"Going to read the clipart section"); 569 psiconv_progress(config,lev+1,off+len,"Going to read the clipart section");
566 if (!(*result = malloc(sizeof(**result)))) 570 if (!(*result = malloc(sizeof(**result))))
567 goto ERROR1; 571 goto ERROR1;
568 572
569 psiconv_progress(lev+2,off+len,"Going to read the section ID"); 573 psiconv_progress(config,lev+2,off+len,"Going to read the section ID");
570 temp = psiconv_read_u32(buf,lev+2,off+len,&res); 574 temp = psiconv_read_u32(config,buf,lev+2,off+len,&res);
571 if (res) 575 if (res)
572 goto ERROR2; 576 goto ERROR2;
573 if (temp != PSICONV_ID_CLIPART_ITEM) { 577 if (temp != PSICONV_ID_CLIPART_ITEM) {
574 psiconv_warn(lev+2,off+len, 578 psiconv_warn(config,lev+2,off+len,
575 "Unexpected value in clipart section preamble (ignored)"); 579 "Unexpected value in clipart section preamble (ignored)");
576 psiconv_debug(lev+2,off+len,"Read %08x, expected %08x",temp, 580 psiconv_debug(config,lev+2,off+len,"Read %08x, expected %08x",temp,
577 PSICONV_ID_CLIPART_ITEM); 581 PSICONV_ID_CLIPART_ITEM);
578 } else 582 } else
579 psiconv_debug(lev+2,off+len,"Clipart ID: %08x", temp); 583 psiconv_debug(config,lev+2,off+len,"Clipart ID: %08x", temp);
580 off += 4; 584 off += 4;
581 585
582 psiconv_progress(lev+2,off+len,"Going to read an unknown long"); 586 psiconv_progress(config,lev+2,off+len,"Going to read an unknown long");
583 temp = psiconv_read_u32(buf,lev+2,off+len,&res); 587 temp = psiconv_read_u32(config,buf,lev+2,off+len,&res);
584 if (res) 588 if (res)
585 goto ERROR2; 589 goto ERROR2;
586 if (temp != 0x02) { 590 if (temp != 0x02) {
587 psiconv_warn(lev+2,off+len, 591 psiconv_warn(config,lev+2,off+len,
588 "Unexpected value in clipart section preamble (ignored)"); 592 "Unexpected value in clipart section preamble (ignored)");
589 psiconv_debug(lev+2,off+len,"Read %08x, expected %08x",temp, 593 psiconv_debug(config,lev+2,off+len,"Read %08x, expected %08x",temp,
590 0x02); 594 0x02);
591 } else 595 } else
592 psiconv_debug(lev+2,off+len,"First unknown long: %08x", temp); 596 psiconv_debug(config,lev+2,off+len,"First unknown long: %08x", temp);
593 off += 4; 597 off += 4;
594 598
595 psiconv_progress(lev+2,off+len,"Going to read a second unknown long"); 599 psiconv_progress(config,lev+2,off+len,"Going to read a second unknown long");
596 temp = psiconv_read_u32(buf,lev+2,off+len,&res); 600 temp = psiconv_read_u32(config,buf,lev+2,off+len,&res);
597 if (res) 601 if (res)
598 goto ERROR2; 602 goto ERROR2;
599 if (temp != 0) { 603 if (temp != 0) {
600 psiconv_warn(lev+2,off+len, 604 psiconv_warn(config,lev+2,off+len,
601 "Unexpected value in clipart section preamble (ignored)"); 605 "Unexpected value in clipart section preamble (ignored)");
602 psiconv_debug(lev+2,off+len,"Read %08x, expected %08x",temp, 0); 606 psiconv_debug(config,lev+2,off+len,"Read %08x, expected %08x",temp, 0);
603 } else 607 } else
604 psiconv_debug(lev+2,off+len,"Second unknown long: %08x", temp); 608 psiconv_debug(config,lev+2,off+len,"Second unknown long: %08x", temp);
605 off += 4; 609 off += 4;
606 610
607 psiconv_progress(lev+2,off+len,"Going to read a third unknown long"); 611 psiconv_progress(config,lev+2,off+len,"Going to read a third unknown long");
608 temp = psiconv_read_u32(buf,lev+2,off+len,&res); 612 temp = psiconv_read_u32(config,buf,lev+2,off+len,&res);
609 if (res) 613 if (res)
610 goto ERROR2; 614 goto ERROR2;
611 if (temp != 0) { 615 if (temp != 0) {
612 psiconv_warn(lev+2,off+len, 616 psiconv_warn(config,lev+2,off+len,
613 "Unexpected value in clipart section preamble (ignored)"); 617 "Unexpected value in clipart section preamble (ignored)");
614 psiconv_debug(lev+2,off+len,"Read %08x, expected %08x",temp, 0); 618 psiconv_debug(config,lev+2,off+len,"Read %08x, expected %08x",temp, 0);
615 } else 619 } else
616 psiconv_debug(lev+2,off+len,"Third unknown long: %08x", temp); 620 psiconv_debug(config,lev+2,off+len,"Third unknown long: %08x", temp);
617 off += 4; 621 off += 4;
618 622
619 psiconv_progress(lev+2,off+len,"Going to read a fourth unknown long"); 623 psiconv_progress(config,lev+2,off+len,"Going to read a fourth unknown long");
620 temp = psiconv_read_u32(buf,lev+2,off+len,&res); 624 temp = psiconv_read_u32(config,buf,lev+2,off+len,&res);
621 if (res) 625 if (res)
622 goto ERROR2; 626 goto ERROR2;
623 if ((temp != 0x0c) && (temp != 0x08)) { 627 if ((temp != 0x0c) && (temp != 0x08)) {
624 psiconv_warn(lev+2,off+len, 628 psiconv_warn(config,lev+2,off+len,
625 "Unexpected value in clipart section preamble (ignored)"); 629 "Unexpected value in clipart section preamble (ignored)");
626 psiconv_debug(lev+2,off+len,"Read %08x, expected %08x or %08x",temp, 630 psiconv_debug(config,lev+2,off+len,"Read %08x, expected %08x or %08x",temp,
627 0x0c, 0x08); 631 0x0c, 0x08);
628 } else 632 } else
629 psiconv_debug(lev+2,off+len,"Fourth unknown long: %08x", temp); 633 psiconv_debug(config,lev+2,off+len,"Fourth unknown long: %08x", temp);
630 off += 4; 634 off += 4;
631 635
632 psiconv_progress(lev+2,off+len,"Going to read the Paint Data Section"); 636 psiconv_progress(config,lev+2,off+len,"Going to read the Paint Data Section");
633 if ((res = psiconv_parse_paint_data_section(buf,lev+2,off+len,&leng,1, 637 if ((res = psiconv_parse_paint_data_section(config,buf,lev+2,off+len,&leng,1,
634 &((*result)->picture)))) 638 &((*result)->picture))))
635 goto ERROR2; 639 goto ERROR2;
636 len += leng; 640 len += leng;
637 641
638 if (length) 642 if (length)
639 *length = len; 643 *length = len;
640 644
641 psiconv_progress(lev,off+len-1, 645 psiconv_progress(config,lev,off+len-1,
642 "End of clipart section (total length: %08x)", len); 646 "End of clipart section (total length: %08x)", len);
643 return 0; 647 return 0;
644 648
645ERROR2: 649ERROR2:
646 free (*result); 650 free (*result);
647ERROR1: 651ERROR1:
648 psiconv_warn(lev+1,off,"Reading of Font failed"); 652 psiconv_warn(config,lev+1,off,"Reading of Font failed");
649 if (length) 653 if (length)
650 *length = 0; 654 *length = 0;
651 if (!res) 655 if (!res)
652 return -PSICONV_E_NOMEM; 656 return -PSICONV_E_NOMEM;
653 else 657 else

Legend:
Removed from v.163  
changed lines
  Added in v.168

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26