… | |
… | |
32 | static void psiconv_free_style_aux(void *style); |
32 | static void psiconv_free_style_aux(void *style); |
33 | static void psiconv_free_in_line_layout_aux(void * layout); |
33 | static void psiconv_free_in_line_layout_aux(void * layout); |
34 | static void psiconv_free_paragraph_aux(void * paragraph); |
34 | static void psiconv_free_paragraph_aux(void * paragraph); |
35 | static void psiconv_free_paint_data_section_aux(void * section); |
35 | static void psiconv_free_paint_data_section_aux(void * section); |
36 | static void psiconv_free_clipart_section_aux(void * section); |
36 | static void psiconv_free_clipart_section_aux(void * section); |
|
|
37 | static void psiconv_free_formula_aux(void *data); |
37 | |
38 | |
38 | static psiconv_word_styles_section psiconv_empty_word_styles_section(void); |
39 | static psiconv_word_styles_section psiconv_empty_word_styles_section(void); |
39 | static psiconv_text_and_layout psiconv_empty_text_and_layout(void); |
40 | static psiconv_text_and_layout psiconv_empty_text_and_layout(void); |
40 | static psiconv_texted_section psiconv_empty_texted_section(void); |
41 | static psiconv_texted_section psiconv_empty_texted_section(void); |
41 | static psiconv_page_header psiconv_empty_page_header(void); |
42 | static psiconv_page_header psiconv_empty_page_header(void); |
42 | static psiconv_page_layout_section psiconv_empty_page_layout_section(void); |
43 | static psiconv_page_layout_section psiconv_empty_page_layout_section(void); |
43 | static psiconv_word_status_section psiconv_empty_word_status_section(void); |
44 | static psiconv_word_status_section psiconv_empty_word_status_section(void); |
44 | static psiconv_word_f psiconv_empty_word_f(void); |
45 | static psiconv_word_f psiconv_empty_word_f(void); |
45 | static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void); |
46 | static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void); |
|
|
47 | static psiconv_formula_list psiconv_empty_formula_list(void); |
|
|
48 | static psiconv_sheet_workbook_section |
|
|
49 | psiconv_empty_sheet_workbook_section(void); |
46 | static psiconv_sheet_f psiconv_empty_sheet_f(void); |
50 | static psiconv_sheet_f psiconv_empty_sheet_f(void); |
47 | static psiconv_texted_f psiconv_empty_texted_f(void); |
51 | static psiconv_texted_f psiconv_empty_texted_f(void); |
48 | static psiconv_paint_data_section psiconv_empty_paint_data_section(void); |
52 | static psiconv_paint_data_section psiconv_empty_paint_data_section(void); |
49 | static psiconv_pictures psiconv_empty_pictures(void); |
53 | static psiconv_pictures psiconv_empty_pictures(void); |
50 | static psiconv_mbm_f psiconv_empty_mbm_f(void); |
54 | static psiconv_mbm_f psiconv_empty_mbm_f(void); |
… | |
… | |
542 | { |
546 | { |
543 | if (section) |
547 | if (section) |
544 | free(section); |
548 | free(section); |
545 | } |
549 | } |
546 | |
550 | |
|
|
551 | void psiconv_free_formula_aux(void *data) |
|
|
552 | { |
|
|
553 | psiconv_formula formula; |
|
|
554 | formula = data; |
|
|
555 | if (formula->type == psiconv_formula_dat_string) |
|
|
556 | free(formula->data.dat_string); |
|
|
557 | else if ((formula->type != psiconv_formula_dat_int) && |
|
|
558 | (formula->type != psiconv_formula_dat_var) && |
|
|
559 | (formula->type != psiconv_formula_dat_float) && |
|
|
560 | (formula->type != psiconv_formula_dat_cellref) && |
|
|
561 | (formula->type != psiconv_formula_dat_cellblock) && |
|
|
562 | (formula->type != psiconv_formula_dat_vcellblock) && |
|
|
563 | (formula->type != psiconv_formula_mark_opsep) && |
|
|
564 | (formula->type != psiconv_formula_mark_opend) && |
|
|
565 | (formula->type != psiconv_formula_mark_eof) && |
|
|
566 | (formula->type != psiconv_formula_unknown)) |
|
|
567 | psiconv_free_formula_list(formula->data.fun_operands); |
|
|
568 | } |
|
|
569 | |
|
|
570 | void psiconv_free_formula(psiconv_formula formula) |
|
|
571 | { |
|
|
572 | if (formula) { |
|
|
573 | psiconv_free_formula_aux(formula); |
|
|
574 | free(formula); |
|
|
575 | } |
|
|
576 | } |
|
|
577 | |
|
|
578 | void psiconv_free_formula_list(psiconv_formula_list list) |
|
|
579 | { |
|
|
580 | if (list) |
|
|
581 | psiconv_list_free_el(list,psiconv_free_formula_aux); |
|
|
582 | } |
|
|
583 | |
|
|
584 | void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) |
|
|
585 | { |
|
|
586 | if (section) { |
|
|
587 | psiconv_free_formula_list(section->formulas); |
|
|
588 | free(section); |
|
|
589 | } |
|
|
590 | } |
|
|
591 | |
547 | void psiconv_free_sheet_f(psiconv_sheet_f file) |
592 | void psiconv_free_sheet_f(psiconv_sheet_f file) |
548 | { |
593 | { |
549 | if (file) { |
594 | if (file) { |
550 | psiconv_free_page_layout_section(file->page_sec); |
595 | psiconv_free_page_layout_section(file->page_sec); |
551 | psiconv_free_sheet_status_section(file->status_sec); |
596 | psiconv_free_sheet_status_section(file->status_sec); |
|
|
597 | psiconv_free_sheet_workbook_section(file->workbook_sec); |
552 | free(file); |
598 | free(file); |
553 | } |
599 | } |
554 | } |
600 | } |
555 | |
601 | |
556 | void psiconv_free_texted_f(psiconv_texted_f file) |
602 | void psiconv_free_texted_f(psiconv_texted_f file) |
… | |
… | |
953 | result->cursor_row = result->cursor_column = 0; |
999 | result->cursor_row = result->cursor_column = 0; |
954 | result->sheet_display_size = result->graph_display_size = 1000; |
1000 | result->sheet_display_size = result->graph_display_size = 1000; |
955 | return result; |
1001 | return result; |
956 | } |
1002 | } |
957 | |
1003 | |
|
|
1004 | psiconv_formula_list psiconv_empty_formula_list(void) |
|
|
1005 | { |
|
|
1006 | return psiconv_list_new(sizeof(struct psiconv_formula_s)); |
|
|
1007 | } |
|
|
1008 | |
|
|
1009 | psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void) |
|
|
1010 | { |
|
|
1011 | psiconv_sheet_workbook_section result; |
|
|
1012 | if (!(result = malloc(sizeof(*result)))) |
|
|
1013 | goto ERROR1; |
|
|
1014 | if (!(result->formulas = psiconv_empty_formula_list())) |
|
|
1015 | goto ERROR2; |
|
|
1016 | return result; |
|
|
1017 | ERROR2: |
|
|
1018 | free(result); |
|
|
1019 | ERROR1: |
|
|
1020 | return NULL; |
|
|
1021 | } |
|
|
1022 | |
|
|
1023 | |
958 | psiconv_sheet_f psiconv_empty_sheet_f(void) |
1024 | psiconv_sheet_f psiconv_empty_sheet_f(void) |
959 | { |
1025 | { |
960 | psiconv_sheet_f result; |
1026 | psiconv_sheet_f result; |
961 | if (!(result = malloc(sizeof(*result)))) |
1027 | if (!(result = malloc(sizeof(*result)))) |
962 | goto ERROR1; |
1028 | goto ERROR1; |
963 | if (!(result->page_sec = psiconv_empty_page_layout_section())) |
1029 | if (!(result->page_sec = psiconv_empty_page_layout_section())) |
964 | goto ERROR2; |
1030 | goto ERROR2; |
965 | if (!(result->status_sec = psiconv_empty_sheet_status_section())) |
1031 | if (!(result->status_sec = psiconv_empty_sheet_status_section())) |
966 | goto ERROR3; |
1032 | goto ERROR3; |
|
|
1033 | if (!(result->workbook_sec = psiconv_empty_sheet_workbook_section())) |
|
|
1034 | goto ERROR4; |
967 | return result; |
1035 | return result; |
|
|
1036 | ERROR4: |
|
|
1037 | psiconv_free_sheet_status_section(result->status_sec); |
968 | ERROR3: |
1038 | ERROR3: |
969 | psiconv_free_page_layout_section(result->page_sec); |
1039 | psiconv_free_page_layout_section(result->page_sec); |
970 | ERROR2: |
1040 | ERROR2: |
971 | free(result); |
1041 | free(result); |
972 | ERROR1: |
1042 | ERROR1: |