1 | /* |
1 | /* |
2 | generate_common.c - Part of psiconv, a PSION 5 file formats converter |
2 | generate_common.c - Part of psiconv, a PSION 5 file formats converter |
3 | Copyright (c) 2000 Frodo Looijaard <frodol@dds.nl> |
3 | Copyright (c) 2000-2005 Frodo Looijaard <frodo@frodo.looijaard.name> |
4 | |
4 | |
5 | This program is free software; you can redistribute it and/or modify |
5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by |
6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or |
7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. |
8 | (at your option) any later version. |
… | |
… | |
23 | #include <string.h> |
23 | #include <string.h> |
24 | |
24 | |
25 | #include "generate_routines.h" |
25 | #include "generate_routines.h" |
26 | #include "error.h" |
26 | #include "error.h" |
27 | |
27 | |
|
|
28 | #ifdef DMALLOC |
|
|
29 | #include <dmalloc.h> |
|
|
30 | #endif |
|
|
31 | |
28 | static int psiconv_write_layout_section(psiconv_buffer buf, |
32 | static int psiconv_write_layout_section(const psiconv_config config, |
|
|
33 | psiconv_buffer buf, int lev, |
29 | const psiconv_text_and_layout value, |
34 | const psiconv_text_and_layout value, |
30 | const psiconv_word_styles_section styles, |
35 | const psiconv_word_styles_section styles, |
31 | int with_styles); |
36 | int with_styles); |
32 | |
37 | |
33 | /* Maybe use a psiconv_header_section variable instead? */ |
38 | /* Maybe use a psiconv_header_section variable instead? */ |
34 | int psiconv_write_header_section(psiconv_buffer buf,psiconv_u32 uid1, |
39 | int psiconv_write_header_section(const psiconv_config config, |
|
|
40 | psiconv_buffer buf,int lev,psiconv_u32 uid1, |
35 | psiconv_u32 uid2, psiconv_u32 uid3) |
41 | psiconv_u32 uid2, psiconv_u32 uid3) |
36 | { |
42 | { |
37 | int res; |
43 | int res; |
|
|
44 | psiconv_progress(config,lev,0,"Writing header section"); |
38 | if ((res = psiconv_write_u32(buf,uid1))) |
45 | if ((res = psiconv_write_u32(config,buf,lev+1,uid1))) |
|
|
46 | goto ERROR; |
|
|
47 | if ((res = psiconv_write_u32(config,buf,lev+1,uid2))) |
|
|
48 | goto ERROR; |
|
|
49 | if ((res = psiconv_write_u32(config,buf,lev+1,uid3))) |
|
|
50 | goto ERROR; |
|
|
51 | if ((res = psiconv_write_u32(config,buf,lev+1, |
|
|
52 | psiconv_checkuid(uid1,uid2,uid3)))) |
|
|
53 | goto ERROR; |
|
|
54 | psiconv_progress(config,lev,0,"End of header section"); |
|
|
55 | return 0; |
|
|
56 | |
|
|
57 | ERROR: |
|
|
58 | psiconv_error(config,lev,0,"Writing of header section failed"); |
39 | return res; |
59 | return res; |
40 | if ((res = psiconv_write_u32(buf,uid2))) |
|
|
41 | return res; |
|
|
42 | if ((res = psiconv_write_u32(buf,uid3))) |
|
|
43 | return res; |
|
|
44 | return psiconv_write_u32(buf,psiconv_checkuid(uid1,uid2,uid3)); |
|
|
45 | } |
60 | } |
46 | |
61 | |
47 | int psiconv_write_section_table_section(psiconv_buffer buf, |
62 | int psiconv_write_section_table_section(const psiconv_config config, |
|
|
63 | psiconv_buffer buf,int lev, |
48 | const psiconv_section_table_section value) |
64 | const psiconv_section_table_section value) |
49 | { |
65 | { |
50 | int res,i; |
66 | int res,i; |
51 | psiconv_section_table_entry entry; |
67 | psiconv_section_table_entry entry; |
52 | |
68 | |
|
|
69 | psiconv_progress(config,lev,0,"Writing section table section"); |
53 | if (!value) { |
70 | if (!value) { |
54 | psiconv_warn(0,psiconv_buffer_length(buf),"Null section table section"); |
71 | psiconv_error(config,lev,0,"Null section table section"); |
55 | return -PSICONV_E_GENERATE; |
72 | res = -PSICONV_E_GENERATE; |
|
|
73 | goto ERROR; |
56 | } |
74 | } |
57 | |
75 | |
58 | if ((res = psiconv_write_u8(buf,2 * psiconv_list_length(value)))) |
76 | if ((res = psiconv_write_u8(config,buf,lev+1,2 * psiconv_list_length(value)))) |
59 | return res; |
77 | goto ERROR; |
60 | for (i = 0; i < psiconv_list_length(value); i++) { |
78 | for (i = 0; i < psiconv_list_length(value); i++) { |
61 | if (!(entry = psiconv_list_get(value,i))) { |
79 | if (!(entry = psiconv_list_get(value,i))) { |
62 | psiconv_warn(0,psiconv_buffer_length(buf),"Massive memory corruption"); |
80 | psiconv_error(config,lev+1,0,"Data structure corruption"); |
63 | return -PSICONV_E_NOMEM; |
81 | res = -PSICONV_E_NOMEM; |
|
|
82 | goto ERROR; |
64 | } |
83 | } |
65 | if ((res = psiconv_write_u32(buf,entry->id))) |
84 | if ((res = psiconv_write_u32(config,buf,lev+1,entry->id))) |
66 | return res; |
85 | goto ERROR; |
67 | if ((res = psiconv_write_offset(buf,entry->offset))) |
86 | if ((res = psiconv_write_offset(config,buf,lev+1,entry->offset))) |
68 | return res; |
87 | goto ERROR; |
69 | } |
88 | } |
|
|
89 | psiconv_progress(config,lev,0,"End of section table section"); |
70 | return -PSICONV_E_OK; |
90 | return -PSICONV_E_OK; |
71 | } |
|
|
72 | |
91 | |
|
|
92 | ERROR: |
|
|
93 | psiconv_error(config,lev,0,"Writing of section table section failed"); |
|
|
94 | return res; |
|
|
95 | } |
|
|
96 | |
73 | int psiconv_write_application_id_section(psiconv_buffer buf,psiconv_u32 id, |
97 | int psiconv_write_application_id_section(const psiconv_config config, |
|
|
98 | psiconv_buffer buf,int lev,psiconv_u32 id, |
74 | const psiconv_string_t text) |
99 | const psiconv_string_t text) |
75 | { |
100 | { |
76 | int res; |
101 | int res; |
|
|
102 | psiconv_progress(config,lev,0,"Writing application id section"); |
77 | if ((res = psiconv_write_u32(buf,id))) |
103 | if ((res = psiconv_write_u32(config,buf,lev+1,id))) |
|
|
104 | goto ERROR; |
|
|
105 | if ((res = psiconv_write_string(config,buf,lev+1,text))) |
|
|
106 | goto ERROR; |
|
|
107 | psiconv_progress(config,lev,0,"End of application id section"); |
|
|
108 | return 0; |
|
|
109 | ERROR: |
|
|
110 | psiconv_error(config,lev,0,"Writing of application id section failed"); |
78 | return res; |
111 | return res; |
79 | return psiconv_write_string(buf,text); |
|
|
80 | } |
112 | } |
81 | |
113 | |
82 | int psiconv_write_text_section(psiconv_buffer buf, |
114 | int psiconv_write_text_section(const psiconv_config config, |
|
|
115 | psiconv_buffer buf,int lev, |
83 | const psiconv_text_and_layout value) |
116 | const psiconv_text_and_layout value) |
84 | { |
117 | { |
85 | int res; |
118 | int res; |
86 | psiconv_buffer extra_buf; |
119 | psiconv_buffer extra_buf = NULL; |
87 | int i,j; |
120 | int i,j; |
88 | psiconv_paragraph paragraph; |
121 | psiconv_paragraph paragraph; |
89 | |
122 | |
|
|
123 | psiconv_progress(config,lev,0,"Writing text section"); |
90 | if (!value) { |
124 | if (!value) { |
91 | psiconv_warn(0,psiconv_buffer_length(buf),"Null text section"); |
125 | psiconv_error(config,lev+1,0,"Null text section"); |
92 | return -PSICONV_E_GENERATE; |
126 | res = -PSICONV_E_GENERATE; |
|
|
127 | goto ERROR; |
93 | } |
128 | } |
94 | |
129 | |
95 | if (psiconv_list_length(value)) { |
130 | if (psiconv_list_length(value)) { |
96 | if (!(extra_buf = psiconv_buffer_new())) |
131 | if (!(extra_buf = psiconv_buffer_new())) { |
|
|
132 | psiconv_error(config,lev+1,0,"Out of memory error"); |
97 | return -PSICONV_E_NOMEM; |
133 | res = -PSICONV_E_NOMEM; |
|
|
134 | goto ERROR; |
|
|
135 | } |
98 | for (i = 0; i < psiconv_list_length(value); i++) { |
136 | for (i = 0; i < psiconv_list_length(value); i++) { |
99 | if (!(paragraph = psiconv_list_get(value,i))) { |
137 | if (!(paragraph = psiconv_list_get(value,i))) { |
100 | psiconv_warn(0,psiconv_buffer_length(buf),"Massive memory corruption"); |
138 | psiconv_error(config,lev+1,0,"Data structure corruption"); |
101 | res = -PSICONV_E_OTHER; |
139 | res = -PSICONV_E_NOMEM; |
102 | goto ERROR; |
140 | goto ERROR; |
103 | } |
141 | } |
104 | for (j = 0; j < strlen(paragraph->text); j++) |
142 | for (j = 0; j < psiconv_unicode_strlen(paragraph->text); j++) |
105 | if ((res = psiconv_write_u8(extra_buf,paragraph->text[j]))) |
143 | if ((res = psiconv_unicode_write_char(config,extra_buf,lev+1, |
|
|
144 | paragraph->text[j]))) |
106 | goto ERROR; |
145 | goto ERROR; |
107 | psiconv_write_u8(extra_buf,0x06); |
146 | psiconv_unicode_write_char(config,extra_buf,lev+1,0x06); |
108 | } |
147 | } |
109 | if ((res = psiconv_write_X(buf,psiconv_buffer_length(extra_buf)))) |
148 | if ((res = psiconv_write_X(config,buf,lev+1,psiconv_buffer_length(extra_buf)))) |
110 | goto ERROR; |
149 | goto ERROR; |
111 | res = psiconv_buffer_concat(buf,extra_buf); |
150 | res = psiconv_buffer_concat(buf,extra_buf); |
112 | } else |
151 | } else |
113 | /* Hack: empty text sections are just not allowed */ |
152 | /* Hack: empty text sections are just not allowed */ |
114 | return psiconv_write_u16(buf,0x0602); |
153 | if ((res = psiconv_write_u16(config,buf,lev+1,0x0602))) |
|
|
154 | goto ERROR; |
|
|
155 | |
|
|
156 | psiconv_progress(config,lev,0,"End of text section"); |
|
|
157 | return 0; |
115 | |
158 | |
116 | ERROR: |
159 | ERROR: |
|
|
160 | if (extra_buf) |
117 | psiconv_buffer_free(extra_buf); |
161 | psiconv_buffer_free(extra_buf); |
|
|
162 | psiconv_error(config,lev,0,"Writing of text section failed"); |
118 | return res; |
163 | return res; |
119 | } |
164 | } |
120 | |
165 | |
121 | int psiconv_write_layout_section(psiconv_buffer buf, |
166 | int psiconv_write_layout_section(const psiconv_config config, |
|
|
167 | psiconv_buffer buf,int lev, |
122 | const psiconv_text_and_layout value, |
168 | const psiconv_text_and_layout value, |
123 | const psiconv_word_styles_section styles, |
169 | const psiconv_word_styles_section styles, |
124 | int with_styles) |
170 | int with_styles) |
125 | { |
171 | { |
126 | typedef struct psiconv_paragraph_type_list_s |
172 | typedef struct psiconv_paragraph_type_list_s |
… | |
… | |
128 | psiconv_character_layout character; |
174 | psiconv_character_layout character; |
129 | psiconv_paragraph_layout paragraph; |
175 | psiconv_paragraph_layout paragraph; |
130 | psiconv_u8 style; |
176 | psiconv_u8 style; |
131 | psiconv_u8 nr; |
177 | psiconv_u8 nr; |
132 | } *psiconv_paragraph_type_list; |
178 | } *psiconv_paragraph_type_list; |
|
|
179 | psiconv_u32 obj_id; |
133 | psiconv_list paragraph_type_list; /* Of psiconv_paragraph_type_list_s */ |
180 | psiconv_list paragraph_type_list; /* Of psiconv_paragraph_type_list_s */ |
134 | psiconv_paragraph_type_list paragraph_type; |
181 | psiconv_paragraph_type_list paragraph_type; |
135 | struct psiconv_paragraph_type_list_s new_type; |
182 | struct psiconv_paragraph_type_list_s new_type; |
136 | psiconv_buffer buf_types,buf_elements,buf_inlines; |
183 | psiconv_buffer buf_types,buf_elements,buf_inlines,buf_objects; |
137 | psiconv_paragraph paragraph; |
184 | psiconv_paragraph paragraph; |
138 | psiconv_in_line_layout in_line; |
185 | psiconv_in_line_layout in_line = NULL; |
139 | psiconv_word_style style; |
186 | psiconv_word_style style; |
140 | psiconv_character_layout para_charlayout; |
187 | psiconv_character_layout para_charlayout; |
141 | int i,j,para_type,nr_of_inlines=0,res,ptl_length,pel_length,thislen,paralen; |
188 | int i,j,para_type,nr_of_inlines=0,res,ptl_length,pel_length,thislen,paralen; |
142 | |
189 | |
|
|
190 | psiconv_progress(config,lev,0,"Writing layout section"); |
143 | if (!value) { |
191 | if (!value) { |
144 | psiconv_warn(0,psiconv_buffer_length(buf),"Null text section"); |
192 | psiconv_error(config,lev,0,"Null text section"); |
145 | return -PSICONV_E_GENERATE; |
193 | res = -PSICONV_E_GENERATE; |
|
|
194 | goto ERROR1; |
146 | } |
195 | } |
147 | |
196 | |
148 | if (!(paragraph_type_list = psiconv_list_new(sizeof(new_type)))) { |
197 | if (!(paragraph_type_list = psiconv_list_new(sizeof(new_type)))) { |
|
|
198 | psiconv_error(config,lev+1,0,"Out of memory error"); |
149 | res = -PSICONV_E_NOMEM; |
199 | res = -PSICONV_E_NOMEM; |
150 | goto ERROR1; |
200 | goto ERROR1; |
151 | } |
201 | } |
152 | |
202 | |
153 | if (!(buf_types = psiconv_buffer_new())) { |
203 | if (!(buf_types = psiconv_buffer_new())) { |
|
|
204 | psiconv_error(config,lev+1,0,"Out of memory error"); |
154 | res = -PSICONV_E_NOMEM; |
205 | res = -PSICONV_E_NOMEM; |
155 | goto ERROR2; |
206 | goto ERROR2; |
156 | } |
207 | } |
157 | |
208 | |
158 | if (!(buf_elements = psiconv_buffer_new())) { |
209 | if (!(buf_elements = psiconv_buffer_new())) { |
|
|
210 | psiconv_error(config,lev+1,0,"Out of memory error"); |
159 | res = -PSICONV_E_NOMEM; |
211 | res = -PSICONV_E_NOMEM; |
160 | goto ERROR3; |
212 | goto ERROR3; |
161 | } |
213 | } |
162 | |
214 | |
163 | if (!(buf_inlines = psiconv_buffer_new())) { |
215 | if (!(buf_inlines = psiconv_buffer_new())) { |
|
|
216 | psiconv_error(config,lev+1,0,"Out of memory error"); |
164 | res = -PSICONV_E_NOMEM; |
217 | res = -PSICONV_E_NOMEM; |
165 | goto ERROR4; |
218 | goto ERROR4; |
166 | } |
219 | } |
167 | |
220 | |
|
|
221 | if (!(buf_objects = psiconv_buffer_new())) { |
|
|
222 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
223 | res = -PSICONV_E_NOMEM; |
|
|
224 | goto ERROR5; |
|
|
225 | } |
|
|
226 | |
168 | for (i = 0; i < psiconv_list_length(value); i++) { |
227 | for (i = 0; i < psiconv_list_length(value); i++) { |
169 | if (!(paragraph = psiconv_list_get(value,i))) { |
228 | if (!(paragraph = psiconv_list_get(value,i))) { |
170 | psiconv_warn(0,psiconv_buffer_length(buf),"Massive memory corruption"); |
229 | psiconv_error(config,lev+1,0,"Data structure corruption"); |
171 | res = -PSICONV_E_OTHER; |
230 | res = -PSICONV_E_NOMEM; |
172 | goto ERROR5; |
231 | goto ERROR6; |
173 | } |
232 | } |
174 | if ((res = psiconv_write_u32(buf_elements,strlen(paragraph->text)+1))) |
233 | if ((res = psiconv_write_u32(config,buf_elements,lev+1, |
|
|
234 | psiconv_unicode_strlen(paragraph->text)+1))) |
175 | goto ERROR5; |
235 | goto ERROR6; |
176 | |
236 | |
|
|
237 | /* We need it for the next if-statement */ |
|
|
238 | if (psiconv_list_length(paragraph->in_lines) == 1) |
|
|
239 | if (!(in_line = psiconv_list_get(paragraph->in_lines,0))) { |
|
|
240 | psiconv_error(config,lev+1,0,"Data structure corruption"); |
|
|
241 | res = -PSICONV_E_NOMEM; |
|
|
242 | goto ERROR6; |
|
|
243 | } |
|
|
244 | |
177 | if (psiconv_list_length(paragraph->in_lines) > 1) { |
245 | if ((psiconv_list_length(paragraph->in_lines) > 1) || |
|
|
246 | ((psiconv_list_length(paragraph->in_lines) == 1) && |
|
|
247 | (in_line->object != NULL))) { |
178 | /* Inline layouts, so we generate a paragraph element and inline |
248 | /* Inline layouts, or an object, so we generate a paragraph element |
179 | elements */ |
249 | and inline elements */ |
180 | if ((res = psiconv_write_u8(buf_elements,0x00))) |
250 | if ((res = psiconv_write_u8(config,buf_elements,lev+1,0x00))) |
181 | goto ERROR5; |
251 | goto ERROR6; |
182 | if (!(style = psiconv_get_style(styles,paragraph->base_style))) { |
252 | if (!(style = psiconv_get_style(styles,paragraph->base_style))) { |
183 | psiconv_warn(0,psiconv_buffer_length(buf),"Unknown style"); |
253 | psiconv_error(config,lev+1,0,"Unknown style"); |
184 | res = -PSICONV_E_GENERATE; |
254 | res = -PSICONV_E_GENERATE; |
185 | goto ERROR5; |
255 | goto ERROR6; |
186 | } |
256 | } |
187 | if ((res = psiconv_write_paragraph_layout_list(buf_elements, |
257 | if ((res = psiconv_write_paragraph_layout_list(config,buf_elements,lev+1, |
188 | paragraph->base_paragraph, |
258 | paragraph->base_paragraph, |
189 | style->paragraph))) |
259 | style->paragraph))) |
190 | goto ERROR5; |
260 | goto ERROR6; |
191 | if (with_styles) |
261 | if (with_styles) |
192 | if ((res = psiconv_write_u8(buf_elements,paragraph->base_style))) |
262 | if ((res = psiconv_write_u8(config,buf_elements,lev+1,paragraph->base_style))) |
193 | goto ERROR5; |
263 | goto ERROR6; |
194 | if ((res = psiconv_write_u32(buf_elements, |
264 | if ((res = psiconv_write_u32(config,buf_elements,lev+1, |
195 | psiconv_list_length(paragraph->in_lines)))) |
265 | psiconv_list_length(paragraph->in_lines)))) |
196 | goto ERROR5; |
266 | goto ERROR6; |
197 | |
267 | |
198 | /* Generate the inlines. NB: Against what are all settings relative?!? */ |
268 | /* Generate the inlines. NB: Against what are all settings relative?!? */ |
199 | paralen = 0; |
269 | paralen = 0; |
200 | for (j = 0; j < psiconv_list_length(paragraph->in_lines); j++) { |
270 | for (j = 0; j < psiconv_list_length(paragraph->in_lines); j++) { |
201 | nr_of_inlines ++; |
271 | nr_of_inlines ++; |
202 | if (!(in_line = psiconv_list_get(paragraph->in_lines,j))) { |
272 | if (!(in_line = psiconv_list_get(paragraph->in_lines,j))) { |
203 | psiconv_warn(0,psiconv_buffer_length(buf), |
273 | psiconv_error(config,lev,0,"Data structure corruption"); |
204 | "Massive memory corruption"); |
|
|
205 | res = -PSICONV_E_OTHER; |
274 | res = -PSICONV_E_NOMEM; |
206 | goto ERROR5; |
275 | goto ERROR6; |
207 | } |
276 | } |
208 | if ((res = psiconv_write_u8(buf_inlines,0x00))) |
277 | if ((res = psiconv_write_u8(config,buf_inlines,lev+1,in_line->object?0x01:0x00))) |
209 | goto ERROR5; |
278 | goto ERROR6; |
210 | thislen = in_line->length; |
279 | thislen = in_line->length; |
211 | paralen += thislen; |
280 | paralen += thislen; |
212 | /* If this is the last in_line, we need to make sure that the |
281 | /* If this is the last in_line, we need to make sure that the |
213 | complete length of all inlines equals the text length */ |
282 | complete length of all inlines equals the text length */ |
214 | if (j == psiconv_list_length(paragraph->in_lines)-1) { |
283 | if (j == psiconv_list_length(paragraph->in_lines)-1) { |
215 | if (paralen > strlen(paragraph->text)+1) { |
284 | if (paralen > psiconv_unicode_strlen(paragraph->text)+1) { |
|
|
285 | psiconv_error(config,lev+1,0,"Inline formatting data length and line length are inconsistent"); |
216 | res = -PSICONV_E_GENERATE; |
286 | res = -PSICONV_E_GENERATE; |
217 | goto ERROR5; |
287 | goto ERROR6; |
218 | } |
288 | } |
219 | thislen += strlen(paragraph->text)+1-paralen; |
289 | thislen += psiconv_unicode_strlen(paragraph->text)+1-paralen; |
220 | } |
290 | } |
221 | if ((res = psiconv_write_u32(buf_inlines,thislen))) |
291 | if ((res = psiconv_write_u32(config,buf_inlines,lev+1,thislen))) |
222 | goto ERROR5; |
292 | goto ERROR6; |
223 | if ((res = psiconv_write_character_layout_list(buf_inlines, |
293 | if ((res = psiconv_write_character_layout_list(config,buf_inlines,lev+1, |
224 | in_line->layout, |
294 | in_line->layout, |
225 | style->character))) |
295 | style->character))) |
226 | goto ERROR5; |
296 | goto ERROR6; |
|
|
297 | if (in_line->object) { |
|
|
298 | if ((res = psiconv_write_u32(config,buf_inlines,lev+1,PSICONV_ID_OBJECT))) |
|
|
299 | goto ERROR6; |
|
|
300 | obj_id = psiconv_buffer_unique_id(); |
|
|
301 | if ((res = psiconv_buffer_add_reference(buf_inlines,obj_id))) { |
|
|
302 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
303 | goto ERROR6; |
|
|
304 | } |
|
|
305 | if ((res = psiconv_buffer_add_target(buf_objects,obj_id))) { |
|
|
306 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
307 | goto ERROR6; |
|
|
308 | } |
|
|
309 | if ((res = psiconv_write_embedded_object_section(config,buf_objects,lev+1, |
|
|
310 | in_line->object))) |
|
|
311 | goto ERROR6; |
|
|
312 | if ((res = psiconv_write_length(config,buf_inlines,lev+1,in_line->object_width))) |
|
|
313 | goto ERROR6; |
|
|
314 | if ((res = psiconv_write_length(config,buf_inlines,lev+1,in_line->object_height))) |
|
|
315 | goto ERROR6; |
|
|
316 | } |
227 | } |
317 | } |
228 | } else { |
318 | } else { |
229 | /* No inline layouts (or only 1), so we generate a paragraph type list */ |
319 | /* No inline layouts (or only 1), so we generate a paragraph type list */ |
230 | para_type = 0; |
320 | para_type = 0; |
231 | /* Set para_charlayout to the correct character-level layout */ |
321 | /* Set para_charlayout to the correct character-level layout */ |
232 | if (psiconv_list_length(paragraph->in_lines) == 0) |
322 | if (psiconv_list_length(paragraph->in_lines) == 0) |
233 | para_charlayout = paragraph->base_character; |
323 | para_charlayout = paragraph->base_character; |
234 | else { |
324 | else { |
235 | if (!(in_line = psiconv_list_get(paragraph->in_lines,0))) { |
325 | if (!(in_line = psiconv_list_get(paragraph->in_lines,0))) { |
236 | psiconv_warn(0,psiconv_buffer_length(buf), |
326 | psiconv_error(config,lev,0,"Data structure corruption"); |
237 | "Massive memory corruption"); |
|
|
238 | res = -PSICONV_E_OTHER; |
327 | res = -PSICONV_E_NOMEM; |
239 | goto ERROR5; |
328 | goto ERROR6; |
240 | } |
329 | } |
241 | para_charlayout = in_line->layout; |
330 | para_charlayout = in_line->layout; |
242 | } |
331 | } |
243 | for (j = 0; j < psiconv_list_length(paragraph_type_list); j++) { |
332 | for (j = 0; j < psiconv_list_length(paragraph_type_list); j++) { |
244 | if (!(paragraph_type = psiconv_list_get(paragraph_type_list,j))) { |
333 | if (!(paragraph_type = psiconv_list_get(paragraph_type_list,j))) { |
245 | psiconv_warn(0,psiconv_buffer_length(buf), |
334 | psiconv_error(config,lev,0,"Data structure corruption"); |
246 | "Massive memory corruption"); |
|
|
247 | res = -PSICONV_E_OTHER; |
335 | res = -PSICONV_E_NOMEM; |
248 | goto ERROR5; |
336 | goto ERROR6; |
249 | } |
337 | } |
250 | if ((paragraph->base_style == paragraph_type->style) && |
338 | if ((paragraph->base_style == paragraph_type->style) && |
251 | !psiconv_compare_character_layout(para_charlayout, |
339 | !psiconv_compare_character_layout(para_charlayout, |
252 | paragraph_type->character) && |
340 | paragraph_type->character) && |
253 | !psiconv_compare_paragraph_layout(paragraph->base_paragraph, |
341 | !psiconv_compare_paragraph_layout(paragraph->base_paragraph, |
… | |
… | |
262 | /* No need to copy them, we won't change them anyway */ |
350 | /* No need to copy them, we won't change them anyway */ |
263 | new_type.paragraph = paragraph->base_paragraph; |
351 | new_type.paragraph = paragraph->base_paragraph; |
264 | new_type.character = para_charlayout; |
352 | new_type.character = para_charlayout; |
265 | new_type.style = paragraph->base_style; |
353 | new_type.style = paragraph->base_style; |
266 | paragraph_type = &new_type; |
354 | paragraph_type = &new_type; |
267 | if ((res = psiconv_list_add(paragraph_type_list,paragraph_type))) |
355 | if ((res = psiconv_list_add(paragraph_type_list,paragraph_type))) { |
|
|
356 | psiconv_error(config,lev+1,0,"Out of memory error"); |
268 | goto ERROR5; |
357 | goto ERROR6; |
|
|
358 | } |
269 | if ((res = psiconv_write_u32(buf_types,paragraph_type->nr))) |
359 | if ((res = psiconv_write_u32(config,buf_types,lev+1,paragraph_type->nr))) |
270 | goto ERROR5; |
360 | goto ERROR6; |
271 | if (!(style = psiconv_get_style(styles,paragraph_type->style))) { |
361 | if (!(style = psiconv_get_style(styles,paragraph_type->style))) { |
272 | psiconv_warn(0,psiconv_buffer_length(buf),"Unknown style"); |
362 | psiconv_error(config,lev,0,"Unknown style"); |
273 | res = -PSICONV_E_GENERATE; |
363 | res = -PSICONV_E_GENERATE; |
274 | goto ERROR5; |
364 | goto ERROR6; |
275 | } |
365 | } |
276 | if ((res = psiconv_write_paragraph_layout_list(buf_types, |
366 | if ((res = psiconv_write_paragraph_layout_list(config,buf_types,lev+1, |
277 | paragraph_type->paragraph,style->paragraph))) |
367 | paragraph_type->paragraph,style->paragraph))) |
278 | goto ERROR5; |
368 | goto ERROR6; |
279 | if (with_styles) |
369 | if (with_styles) |
280 | if ((res = psiconv_write_u8(buf_types,paragraph_type->style))) |
370 | if ((res = psiconv_write_u8(config,buf_types,lev+1,paragraph_type->style))) |
281 | goto ERROR5; |
371 | goto ERROR6; |
282 | if ((res = psiconv_write_character_layout_list(buf_types, |
372 | if ((res = psiconv_write_character_layout_list(config,buf_types,lev+1, |
283 | paragraph_type->character,style->character))) |
373 | paragraph_type->character,style->character))) |
284 | goto ERROR5; |
374 | goto ERROR6; |
285 | } |
375 | } |
286 | if ((res = psiconv_write_u8(buf_elements,para_type))) |
376 | if ((res = psiconv_write_u8(config,buf_elements,lev+1,para_type))) |
287 | goto ERROR5; |
377 | goto ERROR6; |
288 | } |
378 | } |
289 | } |
379 | } |
290 | |
380 | |
291 | /* HACK: special case: no paragraphs at all. We need to improvize. */ |
381 | /* HACK: special case: no paragraphs at all. We need to improvize. */ |
292 | if (!psiconv_list_length(value)) { |
382 | if (!psiconv_list_length(value)) { |
293 | if ((res = psiconv_write_u32(buf_types,1))) |
383 | if ((res = psiconv_write_u32(config,buf_types,lev+1,1))) |
294 | goto ERROR5; |
384 | goto ERROR6; |
295 | if ((res = psiconv_write_u32(buf_types,0))) |
385 | if ((res = psiconv_write_u32(config,buf_types,lev+1,0))) |
296 | goto ERROR5; |
386 | goto ERROR6; |
297 | if (with_styles) |
387 | if (with_styles) |
298 | if ((res = psiconv_write_u8(buf_types,0))) |
388 | if ((res = psiconv_write_u8(config,buf_types,lev+1,0))) |
299 | goto ERROR5; |
389 | goto ERROR6; |
300 | if ((res = psiconv_write_u32(buf_types,0))) |
390 | if ((res = psiconv_write_u32(config,buf_types,lev+1,0))) |
301 | goto ERROR5; |
391 | goto ERROR6; |
302 | |
392 | |
303 | if ((res = psiconv_write_u32(buf_elements,1))) |
393 | if ((res = psiconv_write_u32(config,buf_elements,lev+1,1))) |
304 | goto ERROR5; |
394 | goto ERROR6; |
305 | if ((res = psiconv_write_u8(buf_elements,1))) |
395 | if ((res = psiconv_write_u8(config,buf_elements,lev+1,1))) |
306 | goto ERROR5; |
396 | goto ERROR6; |
307 | pel_length = 1; |
397 | pel_length = 1; |
308 | ptl_length = 1; |
398 | ptl_length = 1; |
309 | } else { |
399 | } else { |
310 | pel_length = psiconv_list_length(value); |
400 | pel_length = psiconv_list_length(value); |
311 | ptl_length = psiconv_list_length(paragraph_type_list); |
401 | ptl_length = psiconv_list_length(paragraph_type_list); |
312 | } |
402 | } |
313 | |
403 | |
314 | /* Now append everything */ |
404 | /* Now append everything */ |
315 | if ((res = psiconv_write_u16(buf,with_styles?0x0001:0x0000))) |
405 | if ((res = psiconv_write_u16(config,buf,lev+1,with_styles?0x0001:0x0000))) |
316 | goto ERROR5; |
406 | goto ERROR6; |
317 | if ((res = psiconv_write_u8(buf, ptl_length))) |
407 | if ((res = psiconv_write_u8(config,buf,lev+1, ptl_length))) |
318 | goto ERROR5; |
408 | goto ERROR6; |
319 | if ((res = psiconv_buffer_concat(buf,buf_types))) |
409 | if ((res = psiconv_buffer_concat(buf,buf_types))) { |
|
|
410 | psiconv_error(config,lev+1,0,"Out of memory error"); |
320 | goto ERROR5; |
411 | goto ERROR6; |
|
|
412 | } |
321 | if ((res = psiconv_write_u32(buf,pel_length))) |
413 | if ((res = psiconv_write_u32(config,buf,lev+1,pel_length))) |
322 | goto ERROR5; |
414 | goto ERROR6; |
323 | if ((res = psiconv_buffer_concat(buf,buf_elements))) |
415 | if ((res = psiconv_buffer_concat(buf,buf_elements))) { |
|
|
416 | psiconv_error(config,lev+1,0,"Out of memory error"); |
324 | goto ERROR5; |
417 | goto ERROR6; |
|
|
418 | } |
325 | if ((res = psiconv_write_u32(buf,nr_of_inlines))) |
419 | if ((res = psiconv_write_u32(config,buf,lev+1,nr_of_inlines))) |
326 | goto ERROR5; |
420 | goto ERROR6; |
327 | res = psiconv_buffer_concat(buf,buf_inlines); |
421 | if ((res = psiconv_buffer_concat(buf,buf_inlines))) { |
|
|
422 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
423 | goto ERROR6; |
|
|
424 | } |
|
|
425 | if ((res = psiconv_buffer_concat(buf,buf_objects))) { |
|
|
426 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
427 | goto ERROR6; |
|
|
428 | } |
328 | |
429 | |
|
|
430 | ERROR6: |
|
|
431 | psiconv_buffer_free(buf_objects); |
329 | ERROR5: |
432 | ERROR5: |
330 | psiconv_buffer_free(buf_inlines); |
433 | psiconv_buffer_free(buf_inlines); |
331 | ERROR4: |
434 | ERROR4: |
332 | psiconv_buffer_free(buf_elements); |
435 | psiconv_buffer_free(buf_elements); |
333 | ERROR3: |
436 | ERROR3: |
334 | psiconv_buffer_free(buf_types); |
437 | psiconv_buffer_free(buf_types); |
335 | ERROR2: |
438 | ERROR2: |
336 | psiconv_list_free(paragraph_type_list); |
439 | psiconv_list_free(paragraph_type_list); |
337 | ERROR1: |
440 | ERROR1: |
|
|
441 | if (res) |
|
|
442 | psiconv_error(config,lev,0,"Writing of layout section failed"); |
|
|
443 | else |
|
|
444 | psiconv_progress(config,lev,0,"End of layout section"); |
338 | return res; |
445 | return res; |
339 | } |
446 | } |
340 | |
447 | |
341 | int psiconv_write_styled_layout_section(psiconv_buffer buf, |
448 | int psiconv_write_styled_layout_section(const psiconv_config config, |
|
|
449 | psiconv_buffer buf,int lev, |
342 | psiconv_text_and_layout result, |
450 | psiconv_text_and_layout result, |
343 | psiconv_word_styles_section styles) |
451 | psiconv_word_styles_section styles) |
344 | { |
452 | { |
|
|
453 | int res; |
|
|
454 | |
|
|
455 | psiconv_progress(config,lev,0,"Writing styled layout section"); |
345 | return psiconv_write_layout_section(buf,result,styles,1); |
456 | res = psiconv_write_layout_section(config,buf,lev+1,result,styles,1); |
|
|
457 | if (res) |
|
|
458 | psiconv_error(config,lev,0,"Writing of styles layout section failed"); |
|
|
459 | else |
|
|
460 | psiconv_progress(config,lev,0,"End of styled layout section"); |
|
|
461 | return res; |
346 | } |
462 | } |
347 | |
463 | |
348 | int psiconv_write_styleless_layout_section(psiconv_buffer buf, |
464 | int psiconv_write_styleless_layout_section(const psiconv_config config, |
|
|
465 | psiconv_buffer buf,int lev, |
349 | const psiconv_text_and_layout value, |
466 | const psiconv_text_and_layout value, |
350 | const psiconv_character_layout base_char, |
467 | const psiconv_character_layout base_char, |
351 | const psiconv_paragraph_layout base_para) |
468 | const psiconv_paragraph_layout base_para) |
352 | { |
469 | { |
353 | int res = 0; |
470 | int res = 0; |
354 | psiconv_word_styles_section styles_section; |
471 | psiconv_word_styles_section styles_section; |
355 | |
472 | |
|
|
473 | psiconv_progress(config,lev,0,"Writing styleless layout section"); |
356 | if (!(styles_section = malloc(sizeof(*styles_section)))) |
474 | if (!(styles_section = malloc(sizeof(*styles_section)))) { |
|
|
475 | psiconv_error(config,lev+1,0,"Out of memory error"); |
357 | goto ERROR1; |
476 | goto ERROR1; |
|
|
477 | } |
358 | if (!(styles_section->normal = malloc(sizeof(*styles_section->normal)))) |
478 | if (!(styles_section->normal = malloc(sizeof(*styles_section->normal)))) { |
|
|
479 | psiconv_error(config,lev+1,0,"Out of memory error"); |
359 | goto ERROR2; |
480 | goto ERROR2; |
|
|
481 | } |
360 | if (!(styles_section->normal->character = |
482 | if (!(styles_section->normal->character = |
361 | psiconv_clone_character_layout(base_char))) |
483 | psiconv_clone_character_layout(base_char))) { |
|
|
484 | psiconv_error(config,lev+1,0,"Out of memory error"); |
362 | goto ERROR3; |
485 | goto ERROR3; |
|
|
486 | } |
363 | if (!(styles_section->normal->paragraph = |
487 | if (!(styles_section->normal->paragraph = |
364 | psiconv_clone_paragraph_layout(base_para))) |
488 | psiconv_clone_paragraph_layout(base_para))) { |
|
|
489 | psiconv_error(config,lev+1,0,"Out of memory error"); |
365 | goto ERROR4; |
490 | goto ERROR4; |
|
|
491 | } |
366 | styles_section->normal->hotkey = 0; |
492 | styles_section->normal->hotkey = 0; |
367 | if (!(styles_section->normal->name = strdup(""))) |
493 | if (!(styles_section->normal->name = psiconv_unicode_empty_string())) { |
|
|
494 | psiconv_error(config,lev+1,0,"Out of memory error"); |
368 | goto ERROR5; |
495 | goto ERROR5; |
|
|
496 | } |
369 | if (!(styles_section->styles = psiconv_list_new(sizeof( |
497 | if (!(styles_section->styles = psiconv_list_new(sizeof( |
370 | struct psiconv_word_style_s)))) |
498 | struct psiconv_word_style_s)))) { |
|
|
499 | psiconv_error(config,lev+1,0,"Out of memory error"); |
371 | goto ERROR6; |
500 | goto ERROR6; |
|
|
501 | } |
372 | |
502 | |
373 | res = psiconv_write_layout_section(buf,value,styles_section,0); |
503 | res = psiconv_write_layout_section(config,buf,lev+1,value,styles_section,0); |
374 | psiconv_free_word_styles_section(styles_section); |
504 | psiconv_free_word_styles_section(styles_section); |
|
|
505 | psiconv_progress(config,lev,0,"End of styleless layout section"); |
375 | return res; |
506 | return res; |
376 | |
507 | |
377 | ERROR6: |
508 | ERROR6: |
378 | free(styles_section->normal->name); |
509 | free(styles_section->normal->name); |
379 | ERROR5: |
510 | ERROR5: |
… | |
… | |
383 | ERROR3: |
514 | ERROR3: |
384 | free(styles_section->normal); |
515 | free(styles_section->normal); |
385 | ERROR2: |
516 | ERROR2: |
386 | free(styles_section); |
517 | free(styles_section); |
387 | ERROR1: |
518 | ERROR1: |
|
|
519 | psiconv_error(config,lev,0,"Writing of styleless layout section failed"); |
388 | if (!res) |
520 | if (!res) |
389 | return -PSICONV_E_NOMEM; |
521 | return -PSICONV_E_NOMEM; |
390 | else |
522 | else |
391 | return res; |
523 | return res; |
392 | } |
524 | } |
|
|
525 | |
|
|
526 | |
|
|
527 | int psiconv_write_embedded_object_section(const psiconv_config config, |
|
|
528 | psiconv_buffer buf,int lev, |
|
|
529 | const psiconv_embedded_object_section value) |
|
|
530 | { |
|
|
531 | int res; |
|
|
532 | psiconv_u32 display_id,icon_id,table_id; |
|
|
533 | psiconv_buffer extra_buf; |
|
|
534 | |
|
|
535 | psiconv_progress(config,lev,0,"Writing embedded object section"); |
|
|
536 | if (!value) { |
|
|
537 | psiconv_error(config,lev,0,"Null Object"); |
|
|
538 | res = -PSICONV_E_GENERATE; |
|
|
539 | goto ERROR1; |
|
|
540 | } |
|
|
541 | |
|
|
542 | if (!(extra_buf = psiconv_buffer_new())) { |
|
|
543 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
544 | res = -PSICONV_E_NOMEM; |
|
|
545 | goto ERROR1; |
|
|
546 | } |
|
|
547 | |
|
|
548 | display_id = psiconv_buffer_unique_id(); |
|
|
549 | icon_id = psiconv_buffer_unique_id(); |
|
|
550 | table_id = psiconv_buffer_unique_id(); |
|
|
551 | if ((res = psiconv_write_u8(config,buf,lev+1,0x06))) |
|
|
552 | goto ERROR2; |
|
|
553 | if ((res = psiconv_write_u32(config,buf,lev+1,PSICONV_ID_OBJECT_DISPLAY_SECTION))) |
|
|
554 | goto ERROR2; |
|
|
555 | if ((res = psiconv_buffer_add_reference(buf,display_id))) { |
|
|
556 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
557 | goto ERROR2; |
|
|
558 | } |
|
|
559 | if ((res = psiconv_write_u32(config,buf,lev+1,PSICONV_ID_OBJECT_ICON_SECTION))) |
|
|
560 | goto ERROR2; |
|
|
561 | if ((res = psiconv_buffer_add_reference(buf,icon_id))) { |
|
|
562 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
563 | goto ERROR2; |
|
|
564 | } |
|
|
565 | if ((res = psiconv_write_u32(config,buf,lev+1,PSICONV_ID_OBJECT_SECTION_TABLE_SECTION))) |
|
|
566 | goto ERROR2; |
|
|
567 | if ((res = psiconv_buffer_add_reference(buf,table_id))) { |
|
|
568 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
569 | goto ERROR2; |
|
|
570 | } |
|
|
571 | |
|
|
572 | if ((res = psiconv_buffer_add_target(buf,display_id))) { |
|
|
573 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
574 | goto ERROR2; |
|
|
575 | } |
|
|
576 | if ((res = psiconv_write_object_display_section(config,buf,lev+1,value->display))) |
|
|
577 | goto ERROR2; |
|
|
578 | if ((res = psiconv_buffer_add_target(buf,icon_id))) { |
|
|
579 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
580 | goto ERROR2; |
|
|
581 | } |
|
|
582 | if ((res = psiconv_write_object_icon_section(config,buf,lev+1,value->icon))) |
|
|
583 | goto ERROR2; |
|
|
584 | if ((res = psiconv_buffer_add_target(buf,table_id))) { |
|
|
585 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
586 | goto ERROR2; |
|
|
587 | } |
|
|
588 | switch(value->object->type) { |
|
|
589 | case psiconv_word_file: |
|
|
590 | if ((res = psiconv_write_word_file(config,extra_buf,lev+1, |
|
|
591 | (psiconv_word_f) value->object->file))) |
|
|
592 | goto ERROR2; |
|
|
593 | break; |
|
|
594 | case psiconv_sketch_file: |
|
|
595 | if ((res = psiconv_write_sketch_file(config,extra_buf,lev+1, |
|
|
596 | (psiconv_sketch_f) value->object->file))) |
|
|
597 | goto ERROR2; |
|
|
598 | break; |
|
|
599 | /* |
|
|
600 | case psiconv_sheet_file: |
|
|
601 | if ((res = psiconv_write_sheet_file(config,extra_buf,lev+1, |
|
|
602 | (psiconv_sheet_f) value->object->file))) |
|
|
603 | goto ERROR2; |
|
|
604 | break; |
|
|
605 | */ |
|
|
606 | default: |
|
|
607 | psiconv_error(config,lev,0,"Unknown or unsupported object type"); |
|
|
608 | res = -PSICONV_E_GENERATE; |
|
|
609 | goto ERROR2; |
|
|
610 | } |
|
|
611 | |
|
|
612 | if ((res = psiconv_buffer_resolve(extra_buf))) { |
|
|
613 | psiconv_error(config,lev+1,0,"Internal error resolving buffer references"); |
|
|
614 | goto ERROR2; |
|
|
615 | } |
|
|
616 | if ((res = psiconv_buffer_concat(buf,extra_buf))) { |
|
|
617 | psiconv_error(config,lev+1,0,"Out of memory error"); |
|
|
618 | goto ERROR2; |
|
|
619 | } |
|
|
620 | psiconv_buffer_free(extra_buf); |
|
|
621 | |
|
|
622 | psiconv_progress(config,lev,0,"End of embedded object section"); |
|
|
623 | return 0; |
|
|
624 | |
|
|
625 | ERROR2: |
|
|
626 | psiconv_buffer_free(extra_buf); |
|
|
627 | ERROR1: |
|
|
628 | psiconv_error(config,lev,0,"Writing of embedded object section failed"); |
|
|
629 | return res; |
|
|
630 | } |
|
|
631 | |
|
|
632 | |
|
|
633 | int psiconv_write_object_display_section(const psiconv_config config, |
|
|
634 | psiconv_buffer buf,int lev, |
|
|
635 | const psiconv_object_display_section value) |
|
|
636 | { |
|
|
637 | int res; |
|
|
638 | |
|
|
639 | psiconv_progress(config,lev,0,"Writing object display section"); |
|
|
640 | |
|
|
641 | if (!value) { |
|
|
642 | psiconv_error(config,lev,0,"Null Object Display Section"); |
|
|
643 | res = -PSICONV_E_GENERATE; |
|
|
644 | goto ERROR1; |
|
|
645 | } |
|
|
646 | |
|
|
647 | if ((res = psiconv_write_u8(config,buf,lev+1,value->show_icon?0x00:0x01))) |
|
|
648 | goto ERROR1; |
|
|
649 | if ((res = psiconv_write_length(config,buf,lev+1,value->width))) |
|
|
650 | goto ERROR1; |
|
|
651 | if ((res = psiconv_write_length(config,buf,lev+1,value->height))) |
|
|
652 | goto ERROR1; |
|
|
653 | if ((res = psiconv_write_u32(config,buf,lev+1,0x00000000))) |
|
|
654 | goto ERROR1; |
|
|
655 | |
|
|
656 | psiconv_progress(config,lev,0,"End of object display section"); |
|
|
657 | |
|
|
658 | return 0; |
|
|
659 | |
|
|
660 | ERROR1: |
|
|
661 | psiconv_error(config,lev,0,"Writing of object display section failed"); |
|
|
662 | return res; |
|
|
663 | } |
|
|
664 | |
|
|
665 | int psiconv_write_object_icon_section(const psiconv_config config, |
|
|
666 | psiconv_buffer buf,int lev, |
|
|
667 | const psiconv_object_icon_section value) |
|
|
668 | { |
|
|
669 | int res; |
|
|
670 | |
|
|
671 | psiconv_progress(config,lev,0,"Writing object icon section"); |
|
|
672 | |
|
|
673 | if (!value) { |
|
|
674 | psiconv_error(config,lev,0,"Null Object Icon Section"); |
|
|
675 | res = -PSICONV_E_GENERATE; |
|
|
676 | goto ERROR1; |
|
|
677 | } |
|
|
678 | |
|
|
679 | if ((res = psiconv_write_string(config,buf,lev+1,value->icon_name))) |
|
|
680 | goto ERROR1; |
|
|
681 | if ((res = psiconv_write_length(config,buf,lev+1,value->icon_width))) |
|
|
682 | goto ERROR1; |
|
|
683 | if ((res = psiconv_write_length(config,buf,lev+1,value->icon_height))) |
|
|
684 | goto ERROR1; |
|
|
685 | |
|
|
686 | psiconv_progress(config,lev,0,"End of object icon section"); |
|
|
687 | return 0; |
|
|
688 | |
|
|
689 | ERROR1: |
|
|
690 | psiconv_error(config,lev,0,"Writing of object icon section failed"); |
|
|
691 | return res; |
|
|
692 | } |