--- psiconv/trunk/lib/psiconv/generate_page.c 2004/01/06 20:15:01 184 +++ psiconv/trunk/lib/psiconv/generate_page.c 2005/11/15 15:52:34 270 @@ -1,6 +1,6 @@ /* generate_page.c - Part of psiconv, a PSION 5 file formats converter - Copyright (c) 2000 Frodo Looijaard + Copyright (c) 2000-2005 Frodo Looijaard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,16 +44,18 @@ psiconv_progress(config,lev,0,"Writing page header"); if (!value) { - psiconv_error(config,0,psiconv_buffer_length(buf),"Null page header"); + psiconv_error(config,lev,0,"Null page header"); res = -PSICONV_E_GENERATE; goto ERROR1; } if (!(basepara=psiconv_basic_paragraph_layout())) { + psiconv_error(config,lev+1,0,"Out of memory error"); res = -PSICONV_E_NOMEM; goto ERROR1; } if (!(basechar=psiconv_basic_character_layout())) { + psiconv_error(config,lev+1,0,"Out of memory error"); res = -PSICONV_E_NOMEM; goto ERROR2; } @@ -84,6 +86,10 @@ ERROR2: psiconv_free_paragraph_layout(basepara); ERROR1: + if (res) + psiconv_error(config,lev,0,"Writing of page header failed"); + else + psiconv_progress(config,lev,0,"End of page header"); return res; } @@ -97,7 +103,7 @@ psiconv_progress(config,lev,0,"Writing page layout section"); if (!value) { - psiconv_error(config,0,psiconv_buffer_length(buf),"Null page section"); + psiconv_error(config,lev,0,"Null page section"); res = -PSICONV_E_GENERATE; goto ERROR1; } @@ -128,9 +134,14 @@ goto ERROR3; if ((res = psiconv_write_bool(config,buf,lev+1,value->landscape))) goto ERROR3; - if ((res = psiconv_buffer_concat(buf,header_buf))) + if ((res = psiconv_buffer_concat(buf,header_buf))) { + psiconv_error(config,lev+1,0,"Out of memory error"); goto ERROR3; - res = psiconv_buffer_concat(buf,footer_buf); + } + if ((res = psiconv_buffer_concat(buf,footer_buf))) { + psiconv_error(config,lev+1,0,"Out of memory error"); + goto ERROR3; + } ERROR3: @@ -138,5 +149,9 @@ ERROR2: psiconv_buffer_free(header_buf); ERROR1: + if (res) + psiconv_error(config,lev,0,"Writing of page layout section failed"); + else + psiconv_progress(config,lev,0,"End of page layout section"); return res; }