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

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

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

Revision 79 Revision 80
62 psiconv_warn(0,psiconv_buffer_length(buf),"Massive memory corruption"); 62 psiconv_warn(0,psiconv_buffer_length(buf),"Massive memory corruption");
63 return -PSICONV_E_NOMEM; 63 return -PSICONV_E_NOMEM;
64 } 64 }
65 if ((res = psiconv_write_u32(buf,entry->id))) 65 if ((res = psiconv_write_u32(buf,entry->id)))
66 return res; 66 return res;
67 if ((res = psiconv_write_u32(buf,entry->offset))) 67 if ((res = psiconv_write_offset(buf,entry->offset)))
68 return res; 68 return res;
69 } 69 }
70 return -PSICONV_E_OK; 70 return -PSICONV_E_OK;
71} 71}
72 72
90 if (!value) { 90 if (!value) {
91 psiconv_warn(0,psiconv_buffer_length(buf),"Null text section"); 91 psiconv_warn(0,psiconv_buffer_length(buf),"Null text section");
92 return -PSICONV_E_GENERATE; 92 return -PSICONV_E_GENERATE;
93 } 93 }
94 94
95 if (!(extra_buf = psiconv_buffer_new(0))) 95 if (!(extra_buf = psiconv_buffer_new()))
96 return -PSICONV_E_NOMEM; 96 return -PSICONV_E_NOMEM;
97 for (i = 0; i < psiconv_list_length(value); i++) { 97 for (i = 0; i < psiconv_list_length(value); i++) {
98 if (!(paragraph = psiconv_list_get(value,i))) { 98 if (!(paragraph = psiconv_list_get(value,i))) {
99 psiconv_warn(0,psiconv_buffer_length(buf),"Massive memory corruption"); 99 psiconv_warn(0,psiconv_buffer_length(buf),"Massive memory corruption");
100 res = -PSICONV_E_OTHER; 100 res = -PSICONV_E_OTHER;
143 if (!(paragraph_type_list = psiconv_list_new(sizeof(new_type)))) { 143 if (!(paragraph_type_list = psiconv_list_new(sizeof(new_type)))) {
144 res = -PSICONV_E_NOMEM; 144 res = -PSICONV_E_NOMEM;
145 goto ERROR1; 145 goto ERROR1;
146 } 146 }
147 147
148 if (!(buf_types = psiconv_buffer_new(0))) { 148 if (!(buf_types = psiconv_buffer_new())) {
149 res = -PSICONV_E_NOMEM; 149 res = -PSICONV_E_NOMEM;
150 goto ERROR2; 150 goto ERROR2;
151 } 151 }
152 152
153 if (!(buf_elements = psiconv_buffer_new(0))) { 153 if (!(buf_elements = psiconv_buffer_new())) {
154 res = -PSICONV_E_NOMEM; 154 res = -PSICONV_E_NOMEM;
155 goto ERROR3; 155 goto ERROR3;
156 } 156 }
157 157
158 if (!(buf_inlines = psiconv_buffer_new(0))) { 158 if (!(buf_inlines = psiconv_buffer_new())) {
159 res = -PSICONV_E_NOMEM; 159 res = -PSICONV_E_NOMEM;
160 goto ERROR4; 160 goto ERROR4;
161 } 161 }
162 162
163 for (i = 0; i < psiconv_list_length(value); i++) { 163 for (i = 0; i < psiconv_list_length(value); i++) {
170 goto ERROR5; 170 goto ERROR5;
171 171
172 if (psiconv_list_length(paragraph->in_lines)) { 172 if (psiconv_list_length(paragraph->in_lines)) {
173 /* Inline layouts, so we generate a paragraph element and inline 173 /* Inline layouts, so we generate a paragraph element and inline
174 elements */ 174 elements */
175 if ((res = psiconv_write_u32(buf_elements,0x00))) 175 if ((res = psiconv_write_u8(buf_elements,0x00)))
176 goto ERROR5; 176 goto ERROR5;
177 if (!(style = psiconv_get_style(styles,paragraph->base_style))) { 177 if (!(style = psiconv_get_style(styles,paragraph->base_style))) {
178 psiconv_warn(0,psiconv_buffer_length(buf),"Unknown style"); 178 psiconv_warn(0,psiconv_buffer_length(buf),"Unknown style");
179 res = -PSICONV_E_GENERATE; 179 res = -PSICONV_E_GENERATE;
180 goto ERROR5; 180 goto ERROR5;
200 } 200 }
201 if ((res = psiconv_write_u8(buf_inlines,0x00))) 201 if ((res = psiconv_write_u8(buf_inlines,0x00)))
202 goto ERROR5; 202 goto ERROR5;
203 if ((res = psiconv_write_u32(buf_inlines,in_line->length))) 203 if ((res = psiconv_write_u32(buf_inlines,in_line->length)))
204 goto ERROR5; 204 goto ERROR5;
205 if ((res = psiconv_write_character_layout_list(buf_elements, 205 if ((res = psiconv_write_character_layout_list(buf_inlines,
206 in_line->layout, 206 in_line->layout,
207 style->character))) 207 style->character)))
208 goto ERROR5; 208 goto ERROR5;
209 } 209 }
210 } else { 210 } else {
256 goto ERROR5; 256 goto ERROR5;
257 } 257 }
258 } 258 }
259 259
260 /* Now append everything */ 260 /* Now append everything */
261 if ((res = psiconv_write_u8(buf,with_styles?0x00:0x01))) 261 if ((res = psiconv_write_u16(buf,with_styles?0x0001:0x0000)))
262 goto ERROR5;
263 if ((res = psiconv_write_u8(buf,0x00)))
264 goto ERROR5; 262 goto ERROR5;
265 if ((res = psiconv_write_u8(buf,psiconv_list_length(paragraph_type_list)))) 263 if ((res = psiconv_write_u8(buf,psiconv_list_length(paragraph_type_list))))
266 goto ERROR5; 264 goto ERROR5;
267 if ((res = psiconv_buffer_concat(buf,buf_types))) 265 if ((res = psiconv_buffer_concat(buf,buf_types)))
268 goto ERROR5; 266 goto ERROR5;

Legend:
Removed from v.79  
changed lines
  Added in v.80

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