--- psiconv/trunk/lib/psiconv/generate_page.c 2000/12/25 22:25:33 79 +++ psiconv/trunk/lib/psiconv/generate_page.c 2000/12/27 02:12:23 80 @@ -28,7 +28,8 @@ int psiconv_write_page_header(psiconv_buffer buf, - const psiconv_page_header value) + const psiconv_page_header value, + psiconv_buffer *extra_buf) { int res; psiconv_paragraph_layout basepara; @@ -69,7 +70,7 @@ goto ERROR3; res = psiconv_write_texted_section(buf,value->text, value->base_character_layout, - value->base_paragraph_layout); + value->base_paragraph_layout,extra_buf); ERROR3: psiconv_free_character_layout(basechar); ERROR2: @@ -82,35 +83,49 @@ const psiconv_page_layout_section value) { int res; + psiconv_buffer header_buf,footer_buf; if (!value) { psiconv_warn(0,psiconv_buffer_length(buf),"Null page section"); - return -PSICONV_E_GENERATE; + res = -PSICONV_E_GENERATE; + goto ERROR1; } if ((res = psiconv_write_u32(buf,value->first_page_nr))) - return res; + goto ERROR1; if ((res = psiconv_write_length(buf,value->header_dist))) - return res; + goto ERROR1; if ((res = psiconv_write_length(buf,value->footer_dist))) - return res; + goto ERROR1; if ((res = psiconv_write_length(buf,value->left_margin))) - return res; + goto ERROR1; if ((res = psiconv_write_length(buf,value->right_margin))) - return res; + goto ERROR1; if ((res = psiconv_write_length(buf,value->top_margin))) - return res; + goto ERROR1; if ((res = psiconv_write_length(buf,value->bottom_margin))) - return res; - if ((res = psiconv_write_page_header(buf,value->header))) - return res; - if ((res = psiconv_write_page_header(buf,value->footer))) - return res; + goto ERROR1; + if ((res = psiconv_write_page_header(buf,value->header,&header_buf))) + goto ERROR1; + if ((res = psiconv_write_page_header(buf,value->footer,&footer_buf))) + goto ERROR2; if ((res = psiconv_write_u32(buf,PSICONV_ID_PAGE_DIMENSIONS2))) - return res; + goto ERROR3; if ((res = psiconv_write_length(buf,value->page_width))) - return res; + goto ERROR3; if ((res = psiconv_write_length(buf,value->page_height))) - return res; - return psiconv_write_bool(buf,value->landscape); + goto ERROR3; + if ((res = psiconv_write_bool(buf,value->landscape))) + goto ERROR3; + if ((res = psiconv_buffer_concat(buf,header_buf))) + goto ERROR3; + res = psiconv_buffer_concat(buf,footer_buf); + + +ERROR3: + psiconv_buffer_free(footer_buf); +ERROR2: + psiconv_buffer_free(header_buf); +ERROR1: + return res; }