… | |
… | |
20 | #include "config.h" |
20 | #include "config.h" |
21 | #include "compat.h" |
21 | #include "compat.h" |
22 | #include <stdlib.h> |
22 | #include <stdlib.h> |
23 | #include <string.h> |
23 | #include <string.h> |
24 | #include "data.h" |
24 | #include "data.h" |
|
|
25 | #include "list.h" |
25 | |
26 | |
26 | static psiconv_color clone_color(psiconv_color color); |
27 | static psiconv_color clone_color(psiconv_color color); |
27 | static psiconv_font clone_font(psiconv_font font); |
28 | static psiconv_font clone_font(psiconv_font font); |
28 | static psiconv_border clone_border(psiconv_border border); |
29 | static psiconv_border clone_border(psiconv_border border); |
29 | static psiconv_bullet clone_bullet(psiconv_bullet bullet); |
30 | static psiconv_bullet clone_bullet(psiconv_bullet bullet); |
… | |
… | |
31 | static void psiconv_free_style_aux(void *style); |
32 | static void psiconv_free_style_aux(void *style); |
32 | static void psiconv_free_in_line_layout_aux(void * layout); |
33 | static void psiconv_free_in_line_layout_aux(void * layout); |
33 | static void psiconv_free_paragraph_aux(void * paragraph); |
34 | static void psiconv_free_paragraph_aux(void * paragraph); |
34 | static void psiconv_free_paint_data_section_aux(void * section); |
35 | static void psiconv_free_paint_data_section_aux(void * section); |
35 | static void psiconv_free_clipart_section_aux(void * section); |
36 | static void psiconv_free_clipart_section_aux(void * section); |
|
|
37 | |
|
|
38 | 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_texted_section psiconv_empty_texted_section(void); |
|
|
41 | static psiconv_page_header psiconv_empty_page_header(void); |
|
|
42 | 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_f psiconv_empty_word_f(void); |
|
|
45 | static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void); |
|
|
46 | static psiconv_formula_list psiconv_empty_formula_list(void); |
|
|
47 | static psiconv_sheet_workbook_section |
|
|
48 | psiconv_empty_sheet_workbook_section(void); |
|
|
49 | static psiconv_sheet_f psiconv_empty_sheet_f(void); |
|
|
50 | static psiconv_texted_f psiconv_empty_texted_f(void); |
|
|
51 | static psiconv_paint_data_section psiconv_empty_paint_data_section(void); |
|
|
52 | static psiconv_pictures psiconv_empty_pictures(void); |
|
|
53 | static psiconv_mbm_f psiconv_empty_mbm_f(void); |
|
|
54 | static psiconv_sketch_section psiconv_empty_sketch_section(void); |
|
|
55 | static psiconv_sketch_f psiconv_empty_sketch_f(void); |
|
|
56 | static psiconv_clipart_f psiconv_empty_clipart_f(void); |
|
|
57 | static psiconv_cliparts psiconv_empty_cliparts(void); |
|
|
58 | |
36 | |
59 | |
37 | /* Note: these defaults seem to be hard-coded somewhere outside the |
60 | /* Note: these defaults seem to be hard-coded somewhere outside the |
38 | files themself. */ |
61 | files themself. */ |
39 | psiconv_character_layout psiconv_basic_character_layout(void) |
62 | psiconv_character_layout psiconv_basic_character_layout(void) |
40 | { |
63 | { |
… | |
… | |
516 | psiconv_free_word_styles_section(file->styles_sec); |
539 | psiconv_free_word_styles_section(file->styles_sec); |
517 | free(file); |
540 | free(file); |
518 | } |
541 | } |
519 | } |
542 | } |
520 | |
543 | |
|
|
544 | void psiconv_free_sheet_status_section(psiconv_sheet_status_section section) |
|
|
545 | { |
|
|
546 | if (section) |
|
|
547 | free(section); |
|
|
548 | } |
|
|
549 | |
|
|
550 | /* TODO: Free sublists, strings etc. depending on formula->type */ |
|
|
551 | void psiconv_free_formula(psiconv_formula formula) |
|
|
552 | { |
|
|
553 | if (formula) |
|
|
554 | free(formula); |
|
|
555 | } |
|
|
556 | |
|
|
557 | void psiconv_free_formula_list(psiconv_formula_list list) |
|
|
558 | { |
|
|
559 | if (list) |
|
|
560 | psiconv_list_free(list); |
|
|
561 | } |
|
|
562 | |
|
|
563 | void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) |
|
|
564 | { |
|
|
565 | if (section) { |
|
|
566 | psiconv_free_formula_list(section->formulas); |
|
|
567 | free(section); |
|
|
568 | } |
|
|
569 | } |
|
|
570 | |
|
|
571 | void psiconv_free_sheet_f(psiconv_sheet_f file) |
|
|
572 | { |
|
|
573 | if (file) { |
|
|
574 | psiconv_free_page_layout_section(file->page_sec); |
|
|
575 | psiconv_free_sheet_status_section(file->status_sec); |
|
|
576 | psiconv_free_sheet_workbook_section(file->workbook_sec); |
|
|
577 | free(file); |
|
|
578 | } |
|
|
579 | } |
|
|
580 | |
521 | void psiconv_free_texted_f(psiconv_texted_f file) |
581 | void psiconv_free_texted_f(psiconv_texted_f file) |
522 | { |
582 | { |
523 | if (file) { |
583 | if (file) { |
524 | psiconv_free_page_layout_section(file->page_sec); |
584 | psiconv_free_page_layout_section(file->page_sec); |
525 | psiconv_free_texted_section(file->texted_sec); |
585 | psiconv_free_texted_section(file->texted_sec); |
… | |
… | |
620 | psiconv_free_mbm_f((psiconv_mbm_f) file->file); |
680 | psiconv_free_mbm_f((psiconv_mbm_f) file->file); |
621 | else if (file->type == psiconv_sketch_file) |
681 | else if (file->type == psiconv_sketch_file) |
622 | psiconv_free_sketch_f((psiconv_sketch_f) file->file); |
682 | psiconv_free_sketch_f((psiconv_sketch_f) file->file); |
623 | else if (file->type == psiconv_clipart_file) |
683 | else if (file->type == psiconv_clipart_file) |
624 | psiconv_free_clipart_f((psiconv_clipart_f) file->file); |
684 | psiconv_free_clipart_f((psiconv_clipart_f) file->file); |
|
|
685 | else if (file->type == psiconv_sheet_file) |
|
|
686 | psiconv_free_sheet_f((psiconv_sheet_f) file->file); |
625 | free(file); |
687 | free(file); |
626 | } |
688 | } |
627 | } |
689 | } |
628 | |
690 | |
629 | int psiconv_compare_color(const psiconv_color value1, |
691 | int psiconv_compare_color(const psiconv_color value1, |
… | |
… | |
758 | !psiconv_compare_font(value1->font,value2->font)) |
820 | !psiconv_compare_font(value1->font,value2->font)) |
759 | return 0; |
821 | return 0; |
760 | else |
822 | else |
761 | return 1; |
823 | return 1; |
762 | } |
824 | } |
|
|
825 | |
|
|
826 | |
|
|
827 | |
|
|
828 | psiconv_word_styles_section psiconv_empty_word_styles_section(void) |
|
|
829 | { |
|
|
830 | psiconv_word_styles_section result; |
|
|
831 | if (!(result = malloc(sizeof(*result)))) |
|
|
832 | goto ERROR1; |
|
|
833 | if (!(result->styles = psiconv_list_new(sizeof(struct psiconv_word_style_s)))) |
|
|
834 | goto ERROR2; |
|
|
835 | if (!(result->normal = malloc(sizeof(struct psiconv_word_style_s)))) |
|
|
836 | goto ERROR3; |
|
|
837 | if (!(result->normal->character = psiconv_basic_character_layout())) |
|
|
838 | goto ERROR4; |
|
|
839 | if (!(result->normal->paragraph = psiconv_basic_paragraph_layout())) |
|
|
840 | goto ERROR5; |
|
|
841 | result->normal->hotkey = 'N'; |
|
|
842 | result->normal->name = NULL; |
|
|
843 | result->normal->built_in = psiconv_bool_true; |
|
|
844 | result->normal->outline_level = 0; |
|
|
845 | return result; |
|
|
846 | ERROR5: |
|
|
847 | psiconv_free_character_layout(result->normal->character); |
|
|
848 | ERROR4: |
|
|
849 | free(result->normal); |
|
|
850 | ERROR3: |
|
|
851 | psiconv_list_free(result->styles); |
|
|
852 | ERROR2: |
|
|
853 | free(result); |
|
|
854 | ERROR1: |
|
|
855 | return NULL; |
|
|
856 | } |
|
|
857 | |
|
|
858 | psiconv_text_and_layout psiconv_empty_text_and_layout(void) |
|
|
859 | { |
|
|
860 | return psiconv_list_new(sizeof(struct psiconv_paragraph_s)); |
|
|
861 | } |
|
|
862 | |
|
|
863 | psiconv_texted_section psiconv_empty_texted_section(void) |
|
|
864 | { |
|
|
865 | psiconv_texted_section result; |
|
|
866 | if (!(result = malloc(sizeof(*result)))) |
|
|
867 | goto ERROR1; |
|
|
868 | if (!(result->paragraphs = psiconv_empty_text_and_layout())) |
|
|
869 | goto ERROR2; |
|
|
870 | return result; |
|
|
871 | ERROR2: |
|
|
872 | free(result); |
|
|
873 | ERROR1: |
|
|
874 | return NULL; |
|
|
875 | } |
|
|
876 | |
|
|
877 | psiconv_page_header psiconv_empty_page_header(void) |
|
|
878 | { |
|
|
879 | psiconv_page_header result; |
|
|
880 | if (!(result = malloc(sizeof(*result)))) |
|
|
881 | goto ERROR1; |
|
|
882 | result->on_first_page = psiconv_bool_true; |
|
|
883 | if (!(result->base_paragraph_layout = psiconv_basic_paragraph_layout())) |
|
|
884 | goto ERROR2; |
|
|
885 | if (!(result->base_character_layout = psiconv_basic_character_layout())) |
|
|
886 | goto ERROR3; |
|
|
887 | if (!(result->text = psiconv_empty_texted_section())) |
|
|
888 | goto ERROR4; |
|
|
889 | return result; |
|
|
890 | ERROR4: |
|
|
891 | psiconv_free_character_layout(result->base_character_layout); |
|
|
892 | ERROR3: |
|
|
893 | psiconv_free_paragraph_layout(result->base_paragraph_layout); |
|
|
894 | ERROR2: |
|
|
895 | free(result); |
|
|
896 | ERROR1: |
|
|
897 | return NULL; |
|
|
898 | } |
|
|
899 | |
|
|
900 | psiconv_page_layout_section psiconv_empty_page_layout_section(void) |
|
|
901 | { |
|
|
902 | psiconv_page_layout_section result; |
|
|
903 | if (!(result = malloc(sizeof(*result)))) |
|
|
904 | goto ERROR1; |
|
|
905 | result->first_page_nr = 1; |
|
|
906 | result->header_dist = result->footer_dist = 1.27; |
|
|
907 | result->left_margin = result->right_margin = 3.175; |
|
|
908 | result->top_margin = result->bottom_margin = 2.54; |
|
|
909 | result->page_width = 21.0; |
|
|
910 | result->page_height = 29.7; |
|
|
911 | result->landscape = psiconv_bool_false; |
|
|
912 | if (!(result->header = psiconv_empty_page_header())) |
|
|
913 | goto ERROR2; |
|
|
914 | if (!(result->footer = psiconv_empty_page_header())) |
|
|
915 | goto ERROR3; |
|
|
916 | return result; |
|
|
917 | ERROR3: |
|
|
918 | psiconv_free_page_header(result->header); |
|
|
919 | ERROR2: |
|
|
920 | free(result); |
|
|
921 | ERROR1: |
|
|
922 | return NULL; |
|
|
923 | } |
|
|
924 | |
|
|
925 | psiconv_word_status_section psiconv_empty_word_status_section(void) |
|
|
926 | { |
|
|
927 | psiconv_word_status_section result; |
|
|
928 | if (!(result = malloc(sizeof(*result)))) |
|
|
929 | return NULL; |
|
|
930 | result->show_tabs = result->show_spaces = result->show_paragraph_ends = |
|
|
931 | result->show_hard_minus = result->show_hard_space = |
|
|
932 | result->fit_lines_to_screen = psiconv_bool_false; |
|
|
933 | result->show_full_pictures = result->show_full_graphs = |
|
|
934 | result->show_top_toolbar = result->show_side_toolbar = |
|
|
935 | psiconv_bool_true; |
|
|
936 | result->cursor_position = 0; |
|
|
937 | result->display_size = 1000; |
|
|
938 | return result; |
|
|
939 | } |
|
|
940 | |
|
|
941 | psiconv_word_f psiconv_empty_word_f(void) |
|
|
942 | { |
|
|
943 | psiconv_word_f result; |
|
|
944 | if (!(result = malloc(sizeof(*result)))) |
|
|
945 | goto ERROR1; |
|
|
946 | if (!(result->page_sec = psiconv_empty_page_layout_section())) |
|
|
947 | goto ERROR2; |
|
|
948 | if (!(result->paragraphs = psiconv_empty_text_and_layout())) |
|
|
949 | goto ERROR3; |
|
|
950 | if (!(result->status_sec = psiconv_empty_word_status_section())) |
|
|
951 | goto ERROR4; |
|
|
952 | if (!(result->styles_sec = psiconv_empty_word_styles_section())) |
|
|
953 | goto ERROR5; |
|
|
954 | return result; |
|
|
955 | ERROR5: |
|
|
956 | psiconv_free_word_status_section(result->status_sec); |
|
|
957 | ERROR4: |
|
|
958 | psiconv_free_text_and_layout(result->paragraphs); |
|
|
959 | ERROR3: |
|
|
960 | psiconv_free_page_layout_section(result->page_sec); |
|
|
961 | ERROR2: |
|
|
962 | free(result); |
|
|
963 | ERROR1: |
|
|
964 | return NULL; |
|
|
965 | } |
|
|
966 | |
|
|
967 | psiconv_sheet_status_section psiconv_empty_sheet_status_section(void) |
|
|
968 | { |
|
|
969 | psiconv_sheet_status_section result; |
|
|
970 | if (!(result = malloc(sizeof(*result)))) |
|
|
971 | return NULL; |
|
|
972 | result->show_horizontal_scrollbar = result->show_vertical_scrollbar = |
|
|
973 | psiconv_triple_auto; |
|
|
974 | result->show_graph = psiconv_bool_false; |
|
|
975 | result->show_top_sheet_toolbar = result->show_side_sheet_toolbar = |
|
|
976 | result->show_top_graph_toolbar = result->show_side_graph_toolbar = |
|
|
977 | psiconv_bool_true; |
|
|
978 | result->cursor_row = result->cursor_column = 0; |
|
|
979 | result->sheet_display_size = result->graph_display_size = 1000; |
|
|
980 | return result; |
|
|
981 | } |
|
|
982 | |
|
|
983 | psiconv_formula_list psiconv_empty_formula_list(void) |
|
|
984 | { |
|
|
985 | return psiconv_list_new(sizeof(struct psiconv_formula_s)); |
|
|
986 | } |
|
|
987 | |
|
|
988 | psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void) |
|
|
989 | { |
|
|
990 | psiconv_sheet_workbook_section result; |
|
|
991 | if (!(result = malloc(sizeof(*result)))) |
|
|
992 | goto ERROR1; |
|
|
993 | if (!(result->formulas = psiconv_empty_formula_list())) |
|
|
994 | goto ERROR2; |
|
|
995 | return result; |
|
|
996 | ERROR2: |
|
|
997 | free(result); |
|
|
998 | ERROR1: |
|
|
999 | return NULL; |
|
|
1000 | } |
|
|
1001 | |
|
|
1002 | |
|
|
1003 | psiconv_sheet_f psiconv_empty_sheet_f(void) |
|
|
1004 | { |
|
|
1005 | psiconv_sheet_f result; |
|
|
1006 | if (!(result = malloc(sizeof(*result)))) |
|
|
1007 | goto ERROR1; |
|
|
1008 | if (!(result->page_sec = psiconv_empty_page_layout_section())) |
|
|
1009 | goto ERROR2; |
|
|
1010 | if (!(result->status_sec = psiconv_empty_sheet_status_section())) |
|
|
1011 | goto ERROR3; |
|
|
1012 | if (!(result->workbook_sec = psiconv_empty_sheet_workbook_section())) |
|
|
1013 | goto ERROR4; |
|
|
1014 | return result; |
|
|
1015 | ERROR4: |
|
|
1016 | psiconv_free_sheet_status_section(result->status_sec); |
|
|
1017 | ERROR3: |
|
|
1018 | psiconv_free_page_layout_section(result->page_sec); |
|
|
1019 | ERROR2: |
|
|
1020 | free(result); |
|
|
1021 | ERROR1: |
|
|
1022 | return NULL; |
|
|
1023 | } |
|
|
1024 | |
|
|
1025 | psiconv_texted_f psiconv_empty_texted_f(void) |
|
|
1026 | { |
|
|
1027 | psiconv_texted_f result; |
|
|
1028 | if (!(result = malloc(sizeof(*result)))) |
|
|
1029 | goto ERROR1; |
|
|
1030 | if (!(result->page_sec = psiconv_empty_page_layout_section())) |
|
|
1031 | goto ERROR2; |
|
|
1032 | if (!(result->texted_sec = psiconv_empty_texted_section())) |
|
|
1033 | goto ERROR3; |
|
|
1034 | return result; |
|
|
1035 | ERROR3: |
|
|
1036 | psiconv_free_page_layout_section(result->page_sec); |
|
|
1037 | ERROR2: |
|
|
1038 | free(result); |
|
|
1039 | ERROR1: |
|
|
1040 | return NULL; |
|
|
1041 | } |
|
|
1042 | |
|
|
1043 | psiconv_paint_data_section psiconv_empty_paint_data_section(void) |
|
|
1044 | { |
|
|
1045 | psiconv_paint_data_section result; |
|
|
1046 | if (!(result = malloc(sizeof(*result)))) |
|
|
1047 | goto ERROR1; |
|
|
1048 | /* Is this correct? */ |
|
|
1049 | result->xsize = result->ysize = result->pic_xsize = result->pic_ysize = 0; |
|
|
1050 | /* Probably forbidden... */ |
|
|
1051 | if (!(result->red = malloc(0))) |
|
|
1052 | goto ERROR2; |
|
|
1053 | if (!(result->green = malloc(0))) |
|
|
1054 | goto ERROR3; |
|
|
1055 | if (!(result->blue = malloc(0))) |
|
|
1056 | goto ERROR4; |
|
|
1057 | return result; |
|
|
1058 | ERROR4: |
|
|
1059 | free(result->green); |
|
|
1060 | ERROR3: |
|
|
1061 | free(result->red); |
|
|
1062 | ERROR2: |
|
|
1063 | free(result); |
|
|
1064 | ERROR1: |
|
|
1065 | return NULL; |
|
|
1066 | } |
|
|
1067 | |
|
|
1068 | |
|
|
1069 | psiconv_pictures psiconv_empty_pictures(void) |
|
|
1070 | { |
|
|
1071 | psiconv_pictures result; |
|
|
1072 | psiconv_paint_data_section pds; |
|
|
1073 | if (!(result = psiconv_list_new(sizeof(struct psiconv_paint_data_section_s)))) |
|
|
1074 | goto ERROR1; |
|
|
1075 | if (!(pds = psiconv_empty_paint_data_section())) |
|
|
1076 | goto ERROR2; |
|
|
1077 | if (psiconv_list_add(result,pds)) |
|
|
1078 | goto ERROR3; |
|
|
1079 | free(pds); |
|
|
1080 | return result; |
|
|
1081 | ERROR3: |
|
|
1082 | psiconv_free_paint_data_section(pds); |
|
|
1083 | ERROR2: |
|
|
1084 | psiconv_list_free(result); |
|
|
1085 | ERROR1: |
|
|
1086 | return NULL; |
|
|
1087 | } |
|
|
1088 | |
|
|
1089 | psiconv_mbm_f psiconv_empty_mbm_f(void) |
|
|
1090 | { |
|
|
1091 | psiconv_mbm_f result; |
|
|
1092 | if (!(result = malloc(sizeof(*result)))) |
|
|
1093 | goto ERROR1; |
|
|
1094 | if (!(result->sections = psiconv_empty_pictures())) |
|
|
1095 | goto ERROR2; |
|
|
1096 | return result; |
|
|
1097 | ERROR2: |
|
|
1098 | free(result); |
|
|
1099 | ERROR1: |
|
|
1100 | return NULL; |
|
|
1101 | } |
|
|
1102 | |
|
|
1103 | psiconv_sketch_section psiconv_empty_sketch_section(void) |
|
|
1104 | { |
|
|
1105 | psiconv_sketch_section result; |
|
|
1106 | if (!(result = malloc(sizeof(*result)))) |
|
|
1107 | goto ERROR1; |
|
|
1108 | result->form_xsize = 320; |
|
|
1109 | result->form_ysize = 200; |
|
|
1110 | result->picture_x_offset = result->picture_y_offset = result->picture_xsize = |
|
|
1111 | result->picture_ysize = 0; |
|
|
1112 | result->magnification_x = result->magnification_y = 1.0; |
|
|
1113 | result->cut_left = result->cut_right = result->cut_top = |
|
|
1114 | result->cut_bottom = 0.0; |
|
|
1115 | if (!(result->picture = psiconv_empty_paint_data_section())) |
|
|
1116 | goto ERROR2; |
|
|
1117 | return result; |
|
|
1118 | ERROR2: |
|
|
1119 | free(result); |
|
|
1120 | ERROR1: |
|
|
1121 | return NULL; |
|
|
1122 | } |
|
|
1123 | |
|
|
1124 | psiconv_sketch_f psiconv_empty_sketch_f(void) |
|
|
1125 | { |
|
|
1126 | psiconv_sketch_f result; |
|
|
1127 | if (!(result = malloc(sizeof(*result)))) |
|
|
1128 | goto ERROR1; |
|
|
1129 | if (!(result->sketch_sec = psiconv_empty_sketch_section())) |
|
|
1130 | goto ERROR2; |
|
|
1131 | return result; |
|
|
1132 | ERROR2: |
|
|
1133 | free(result); |
|
|
1134 | ERROR1: |
|
|
1135 | return NULL; |
|
|
1136 | } |
|
|
1137 | |
|
|
1138 | psiconv_cliparts psiconv_empty_cliparts(void) |
|
|
1139 | { |
|
|
1140 | /* Is this correct? */ |
|
|
1141 | return psiconv_list_new(sizeof(struct psiconv_clipart_section_s)); |
|
|
1142 | } |
|
|
1143 | |
|
|
1144 | psiconv_clipart_f psiconv_empty_clipart_f(void) |
|
|
1145 | { |
|
|
1146 | psiconv_clipart_f result; |
|
|
1147 | if (!(result = malloc(sizeof(*result)))) |
|
|
1148 | goto ERROR1; |
|
|
1149 | if (!(result->sections = psiconv_empty_cliparts())) |
|
|
1150 | goto ERROR2; |
|
|
1151 | return result; |
|
|
1152 | ERROR2: |
|
|
1153 | free(result); |
|
|
1154 | ERROR1: |
|
|
1155 | return NULL; |
|
|
1156 | } |
|
|
1157 | |
|
|
1158 | psiconv_file psiconv_empty_file(psiconv_file_type_t type) |
|
|
1159 | { |
|
|
1160 | psiconv_file result; |
|
|
1161 | if (!(result = malloc(sizeof(*result)))) |
|
|
1162 | return NULL; |
|
|
1163 | result->type = type; |
|
|
1164 | if (type == psiconv_word_file) { |
|
|
1165 | if (!(result->file = psiconv_empty_word_f())) |
|
|
1166 | goto ERROR; |
|
|
1167 | } else if (type == psiconv_sheet_file) { |
|
|
1168 | if (!(result->file = psiconv_empty_sheet_f())) |
|
|
1169 | goto ERROR; |
|
|
1170 | } else if (type == psiconv_texted_file) { |
|
|
1171 | if (!(result->file = psiconv_empty_texted_f())) |
|
|
1172 | goto ERROR; |
|
|
1173 | } else if (type == psiconv_mbm_file) { |
|
|
1174 | if (!(result->file = psiconv_empty_mbm_f())) |
|
|
1175 | goto ERROR; |
|
|
1176 | } else if (type == psiconv_sketch_file) { |
|
|
1177 | if (!(result->file = psiconv_empty_sketch_f())) |
|
|
1178 | goto ERROR; |
|
|
1179 | } else if (type == psiconv_clipart_file) { |
|
|
1180 | if (!(result->file = psiconv_empty_clipart_f())) |
|
|
1181 | goto ERROR; |
|
|
1182 | } else |
|
|
1183 | goto ERROR; |
|
|
1184 | return result; |
|
|
1185 | ERROR: |
|
|
1186 | free(result); |
|
|
1187 | return NULL; |
|
|
1188 | } |