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

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

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

Revision 217 Revision 268
277 277
278 psiconv_u32 text_len; 278 psiconv_u32 text_len;
279 psiconv_paragraph para; 279 psiconv_paragraph para;
280 psiconv_ucs2 temp; 280 psiconv_ucs2 temp;
281 psiconv_list line; 281 psiconv_list line;
282 psiconv_ucs2 *nextcharptr;
283 282
284 int nr; 283 int nr;
285 int i,j,leng; 284 int i,leng;
286 char *str_copy; 285 char *str_copy;
287 286
288 psiconv_progress(config,lev+1,off,"Going to parse the text section"); 287 psiconv_progress(config,lev+1,off,"Going to parse the text section");
289 288
290 if(!(*result = psiconv_list_new(sizeof(*para)))) 289 if(!(*result = psiconv_list_new(sizeof(*para))))
312 psiconv_error(config,lev+2,off+len+i,"Malformed text section"); 311 psiconv_error(config,lev+2,off+len+i,"Malformed text section");
313 res = PSICONV_E_PARSE; 312 res = PSICONV_E_PARSE;
314 goto ERROR4; 313 goto ERROR4;
315 } 314 }
316 if ((temp == 0x06) || (i + leng == text_len)) { 315 if ((temp == 0x06) || (i + leng == text_len)) {
317 if (!(para->text = malloc(sizeof(*(para->text)) * 316 if (!(para->text = psiconv_unicode_from_list(line)))
318 (psiconv_list_length(line) + 1))))
319 goto ERROR4; 317 goto ERROR4;
320 for (j = 0; j < psiconv_list_length(line); j++) {
321 if (!(nextcharptr = psiconv_list_get(line,j))) {
322 psiconv_error(config,lev+2,off+i+len,"Internal data corruption");
323 goto ERROR5;
324 }
325 para->text[j] = *nextcharptr;
326 }
327 para->text[j] = 0;
328 318
329 if (!(str_copy = psiconv_make_printable(config,para->text))) 319 if (!(str_copy = psiconv_make_printable(config,para->text)))
330 goto ERROR5; 320 goto ERROR5;
331 psiconv_debug(config,lev+2,off+i+len,"Line %d: %d characters",nr, 321 psiconv_debug(config,lev+2,off+i+len,"Line %d: %d characters",nr,
332 strlen(str_copy) +1); 322 strlen(str_copy) +1);
578 goto ERROR4; 568 goto ERROR4;
579 if (temp != 0x00) { 569 if (temp != 0x00) {
580 psiconv_debug(config,lev+4,off+len,"Type: %02x",temp); 570 psiconv_debug(config,lev+4,off+len,"Type: %02x",temp);
581 for (j = 0; j < psiconv_list_length(anon_styles); j++) { 571 for (j = 0; j < psiconv_list_length(anon_styles); j++) {
582 if (!(anon_ptr = psiconv_list_get(anon_styles,j))) { 572 if (!(anon_ptr = psiconv_list_get(anon_styles,j))) {
583 psiconv_error(config,lev+4,off+len,"Massive memory curruption"); 573 psiconv_error(config,lev+4,off+len,"Data structure corruption");
584 goto ERROR4; 574 goto ERROR4;
585 } 575 }
586 if (temp == anon_ptr->nr) 576 if (temp == anon_ptr->nr)
587 break; 577 break;
588 } 578 }
684 psiconv_progress(config,lev+3,off+len, 674 psiconv_progress(config,lev+3,off+len,
685 "Going to read the text layout inline elements"); 675 "Going to read the text layout inline elements");
686 total = 0; 676 total = 0;
687 for (i = 0; i < psiconv_list_length(result); i++) { 677 for (i = 0; i < psiconv_list_length(result); i++) {
688 if (!(para = psiconv_list_get(result,i))) { 678 if (!(para = psiconv_list_get(result,i))) {
689 psiconv_error(config,lev+3,off+len,"Massive memory corruption"); 679 psiconv_error(config,lev+3,off+len,"Data structure corruption");
690 goto ERROR4; 680 goto ERROR4;
691 } 681 }
692 line_length = -1; 682 line_length = -1;
693 for (j = 0; j < inline_count[i]; j++) { 683 for (j = 0; j < inline_count[i]; j++) {
694 psiconv_progress(config,lev+3,off+len,"Element %d: Paragraph %d, element %d", 684 psiconv_progress(config,lev+3,off+len,"Element %d: Paragraph %d, element %d",
789 779
790 free(inline_count); 780 free(inline_count);
791 781
792 for (i = 0 ; i < psiconv_list_length(anon_styles); i ++) { 782 for (i = 0 ; i < psiconv_list_length(anon_styles); i ++) {
793 if (!(anon_ptr = psiconv_list_get(anon_styles,i))) { 783 if (!(anon_ptr = psiconv_list_get(anon_styles,i))) {
794 psiconv_error(config,lev+4,off+len,"Massive memory corruption"); 784 psiconv_error(config,lev+4,off+len,"Data structure corruption");
795 goto ERROR2; 785 goto ERROR2;
796 } 786 }
797 psiconv_free_character_layout(anon_ptr->character); 787 psiconv_free_character_layout(anon_ptr->character);
798 psiconv_free_paragraph_layout(anon_ptr->paragraph); 788 psiconv_free_paragraph_layout(anon_ptr->paragraph);
799 } 789 }
831ERROR4: 821ERROR4:
832 free(inline_count); 822 free(inline_count);
833ERROR3: 823ERROR3:
834 for (i = 0; i < psiconv_list_length(anon_styles); i++) { 824 for (i = 0; i < psiconv_list_length(anon_styles); i++) {
835 if (!(anon_ptr = psiconv_list_get(anon_styles,i))) { 825 if (!(anon_ptr = psiconv_list_get(anon_styles,i))) {
836 psiconv_error(config,lev+1,off,"Massive memory corruption"); 826 psiconv_error(config,lev+1,off,"Data structure corruption");
837 break; 827 break;
838 } 828 }
839 psiconv_free_paragraph_layout(anon_ptr->paragraph); 829 psiconv_free_paragraph_layout(anon_ptr->paragraph);
840 psiconv_free_character_layout(anon_ptr->character); 830 psiconv_free_character_layout(anon_ptr->character);
841 } 831 }
1234 1224
1235 psiconv_progress(config,lev+2,off+len,"Going to read the icon name"); 1225 psiconv_progress(config,lev+2,off+len,"Going to read the icon name");
1236 (*result)->icon_name = psiconv_read_string(config,buf,lev+2,off+len,&leng,&res); 1226 (*result)->icon_name = psiconv_read_string(config,buf,lev+2,off+len,&leng,&res);
1237 if (res) 1227 if (res)
1238 goto ERROR2; 1228 goto ERROR2;
1239 psiconv_debug(config,lev+2,off+len,"Icon name: %s",(*result)->icon_name);
1240 len += leng; 1229 len += leng;
1241 1230
1242 psiconv_progress(config,lev+2,off+len,"Going to read the icon width"); 1231 psiconv_progress(config,lev+2,off+len,"Going to read the icon width");
1243 (*result)->icon_width = psiconv_read_length(config,buf,lev+2,off+len,&leng,&res); 1232 (*result)->icon_width = psiconv_read_length(config,buf,lev+2,off+len,&leng,&res);
1244 if (res) 1233 if (res)

Legend:
Removed from v.217  
changed lines
  Added in v.268

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