… | |
… | |
302 | return res; |
302 | return res; |
303 | } |
303 | } |
304 | |
304 | |
305 | int psiconv_write_sketch_section(const psiconv_config config, |
305 | int psiconv_write_sketch_section(const psiconv_config config, |
306 | psiconv_buffer buf, |
306 | psiconv_buffer buf, |
307 | psiconv_sketch_section value) |
307 | const psiconv_sketch_section value) |
308 | { |
308 | { |
309 | int res; |
309 | int res; |
310 | |
310 | |
311 | if (!value) { |
311 | if (!value) { |
312 | psiconv_warn(config,0,0,"NULL sketch section"); |
312 | psiconv_warn(config,0,0,"NULL sketch section"); |
… | |
… | |
352 | goto ERROR1; |
352 | goto ERROR1; |
353 | |
353 | |
354 | ERROR1: |
354 | ERROR1: |
355 | return res; |
355 | return res; |
356 | } |
356 | } |
|
|
357 | |
|
|
358 | int psiconv_write_jumptable_section(const psiconv_config config, |
|
|
359 | psiconv_buffer buf, |
|
|
360 | const psiconv_jumptable_section value) |
|
|
361 | { |
|
|
362 | int res,i; |
|
|
363 | psiconv_u32 *offset_ptr; |
|
|
364 | |
|
|
365 | |
|
|
366 | if (!value) { |
|
|
367 | psiconv_warn(config,0,psiconv_buffer_length(buf), |
|
|
368 | "NULL Jumptable Section"); |
|
|
369 | res = -PSICONV_E_GENERATE; |
|
|
370 | goto ERROR; |
|
|
371 | } |
|
|
372 | if ((res = psiconv_write_u32(config,buf,psiconv_list_length(value)))) |
|
|
373 | goto ERROR; |
|
|
374 | for (i = 0; i < psiconv_list_length(value); i++) { |
|
|
375 | if (!(offset_ptr = psiconv_list_get(value,i))) { |
|
|
376 | psiconv_warn(config,0,psiconv_buffer_length(buf), |
|
|
377 | "Massive memory corruption"); |
|
|
378 | res = -PSICONV_E_NOMEM; |
|
|
379 | goto ERROR; |
|
|
380 | } |
|
|
381 | if ((res = psiconv_write_offset(config,buf,*offset_ptr))) |
|
|
382 | goto ERROR; |
|
|
383 | } |
|
|
384 | |
|
|
385 | ERROR: |
|
|
386 | return res; |
|
|
387 | } |