… | |
… | |
26 | #include "generate_routines.h" |
26 | #include "generate_routines.h" |
27 | |
27 | |
28 | |
28 | |
29 | int psiconv_write(psiconv_buffer *buf,const psiconv_file value) |
29 | int psiconv_write(psiconv_buffer *buf,const psiconv_file value) |
30 | { |
30 | { |
31 | int allocated = 0; |
|
|
32 | int res; |
31 | int res; |
33 | |
32 | |
34 | if (!value) { |
33 | if (!value) { |
35 | psiconv_warn(0,0,"Can't parse to an empty buffer!"); |
34 | psiconv_warn(0,0,"Can't parse to an empty buffer!"); |
36 | return -PSICONV_E_OTHER; |
35 | return -PSICONV_E_OTHER; |
37 | } |
36 | } |
38 | if (!*buf) { |
|
|
39 | if (!(*buf = psiconv_new_buffer())) |
37 | if (!(*buf = psiconv_new_buffer())) |
40 | return -PSICONV_E_NOMEM; |
38 | return -PSICONV_E_NOMEM; |
41 | allocated = 1; |
|
|
42 | } |
|
|
43 | |
39 | |
44 | #if 0 |
40 | #if 0 |
45 | if (value->type == psiconv_word_file) { |
41 | if (value->type == psiconv_word_file) { |
46 | if ((res =psiconv_write_word_file(*buf,(psiconv_word_f) (value->file)))) |
42 | if ((res =psiconv_write_word_file(*buf,(psiconv_word_f) (value->file)))) |
47 | goto ERROR; |
43 | goto ERROR; |
… | |
… | |
71 | goto ERROR; |
67 | goto ERROR; |
72 | } |
68 | } |
73 | return -PSICONV_E_OK; |
69 | return -PSICONV_E_OK; |
74 | |
70 | |
75 | ERROR: |
71 | ERROR: |
76 | if (allocated) |
|
|
77 | psiconv_free_buffer(*buf); |
72 | psiconv_free_buffer(*buf); |
78 | return res; |
73 | return res; |
79 | } |
74 | } |
80 | |
75 | |
81 | int psiconv_write_texted_file(psiconv_buffer buf,psiconv_texted_f value) |
76 | int psiconv_write_texted_file(psiconv_buffer buf,psiconv_texted_f value) |
82 | { |
77 | { |