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

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

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

Revision 196 Revision 233
42 psiconv_character_layout basechar; 42 psiconv_character_layout basechar;
43 43
44 psiconv_progress(config,lev,0,"Writing page header"); 44 psiconv_progress(config,lev,0,"Writing page header");
45 45
46 if (!value) { 46 if (!value) {
47 psiconv_error(config,0,psiconv_buffer_length(buf),"Null page header"); 47 psiconv_error(config,lev,0,"Null page header");
48 res = -PSICONV_E_GENERATE; 48 res = -PSICONV_E_GENERATE;
49 goto ERROR1; 49 goto ERROR1;
50 } 50 }
51 51
52 if (!(basepara=psiconv_basic_paragraph_layout())) { 52 if (!(basepara=psiconv_basic_paragraph_layout())) {
53 psiconv_error(config,lev+1,0,"Out of memory error");
53 res = -PSICONV_E_NOMEM; 54 res = -PSICONV_E_NOMEM;
54 goto ERROR1; 55 goto ERROR1;
55 } 56 }
56 if (!(basechar=psiconv_basic_character_layout())) { 57 if (!(basechar=psiconv_basic_character_layout())) {
58 psiconv_error(config,lev+1,0,"Out of memory error");
57 res = -PSICONV_E_NOMEM; 59 res = -PSICONV_E_NOMEM;
58 goto ERROR2; 60 goto ERROR2;
59 } 61 }
60 62
61 /* Unknown byte */ 63 /* Unknown byte */
82ERROR3: 84ERROR3:
83 psiconv_free_character_layout(basechar); 85 psiconv_free_character_layout(basechar);
84ERROR2: 86ERROR2:
85 psiconv_free_paragraph_layout(basepara); 87 psiconv_free_paragraph_layout(basepara);
86ERROR1: 88ERROR1:
89 if (res)
90 psiconv_error(config,lev,0,"Writing of page header failed");
91 else
92 psiconv_progress(config,lev,0,"End of page header");
87 return res; 93 return res;
88} 94}
89 95
90int psiconv_write_page_layout_section(const psiconv_config config, 96int psiconv_write_page_layout_section(const psiconv_config config,
91 psiconv_buffer buf, int lev, 97 psiconv_buffer buf, int lev,
95 psiconv_buffer header_buf,footer_buf; 101 psiconv_buffer header_buf,footer_buf;
96 102
97 psiconv_progress(config,lev,0,"Writing page layout section"); 103 psiconv_progress(config,lev,0,"Writing page layout section");
98 104
99 if (!value) { 105 if (!value) {
100 psiconv_error(config,0,psiconv_buffer_length(buf),"Null page section"); 106 psiconv_error(config,lev,0,"Null page section");
101 res = -PSICONV_E_GENERATE; 107 res = -PSICONV_E_GENERATE;
102 goto ERROR1; 108 goto ERROR1;
103 } 109 }
104 110
105 if ((res = psiconv_write_u32(config,buf,lev+1,value->first_page_nr))) 111 if ((res = psiconv_write_u32(config,buf,lev+1,value->first_page_nr)))
126 goto ERROR3; 132 goto ERROR3;
127 if ((res = psiconv_write_length(config,buf,lev+1,value->page_height))) 133 if ((res = psiconv_write_length(config,buf,lev+1,value->page_height)))
128 goto ERROR3; 134 goto ERROR3;
129 if ((res = psiconv_write_bool(config,buf,lev+1,value->landscape))) 135 if ((res = psiconv_write_bool(config,buf,lev+1,value->landscape)))
130 goto ERROR3; 136 goto ERROR3;
131 if ((res = psiconv_buffer_concat(buf,header_buf))) 137 if ((res = psiconv_buffer_concat(buf,header_buf))) {
138 psiconv_error(config,lev+1,0,"Out of memory error");
132 goto ERROR3; 139 goto ERROR3;
140 }
133 res = psiconv_buffer_concat(buf,footer_buf); 141 if ((res = psiconv_buffer_concat(buf,footer_buf))) {
142 psiconv_error(config,lev+1,0,"Out of memory error");
143 goto ERROR3;
144 }
134 145
135 146
136ERROR3: 147ERROR3:
137 psiconv_buffer_free(footer_buf); 148 psiconv_buffer_free(footer_buf);
138ERROR2: 149ERROR2:
139 psiconv_buffer_free(header_buf); 150 psiconv_buffer_free(header_buf);
140ERROR1: 151ERROR1:
152 if (res)
153 psiconv_error(config,lev,0,"Writing of page layout section failed");
154 else
155 psiconv_progress(config,lev,0,"End of page layout section");
141 return res; 156 return res;
142} 157}

Legend:
Removed from v.196  
changed lines
  Added in v.233

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