--- psiconv/trunk/lib/psiconv/generate_word.c 2000/12/25 00:26:53 76 +++ psiconv/trunk/lib/psiconv/generate_word.c 2002/01/29 18:38:38 142 @@ -25,13 +25,18 @@ #include "generate_routines.h" #include "error.h" -int psiconv_generate_word_status_section(psiconv_buffer buf, +#ifdef DMALLOC +#include +#endif + + +int psiconv_write_word_status_section(psiconv_buffer buf, psiconv_word_status_section value) { int res; if (!value) { - psiconv_warn(0,psiconv_list_length(buf),"Null word status section"); + psiconv_warn(0,psiconv_buffer_length(buf),"Null word status section"); return -PSICONV_E_GENERATE; } @@ -65,10 +70,11 @@ psiconv_word_style style; psiconv_paragraph_layout basepara; psiconv_character_layout basechar; + psiconv_font font; if (!value || !value->normal || !value->styles) { - psiconv_warn(0,psiconv_list_length(buf),"Null word styles section"); + psiconv_warn(0,psiconv_buffer_length(buf),"Null word styles section"); res = -PSICONV_E_GENERATE; goto ERROR1; } @@ -87,8 +93,13 @@ if ((res = psiconv_write_paragraph_layout_list(buf,value->normal->paragraph, basepara))) goto ERROR3; - if ((res = psiconv_write_character_layout_list(buf,value->normal->character, - basechar))) + /* Always generate the font for Normal */ + font = basechar->font; + basechar->font = NULL; + res = psiconv_write_character_layout_list(buf,value->normal->character, + basechar); + basechar->font = font; + if (res) goto ERROR3; if ((res = psiconv_write_u32(buf,value->normal->hotkey))) goto ERROR3; @@ -99,7 +110,7 @@ for (i = 0; i < psiconv_list_length(value->styles); i++) { if (!(style = psiconv_list_get(value->styles,i))) { - psiconv_warn(0,psiconv_list_length(buf),"Massive memory corruption"); + psiconv_warn(0,psiconv_buffer_length(buf),"Massive memory corruption"); res = -PSICONV_E_OTHER; goto ERROR3; } @@ -110,12 +121,12 @@ goto ERROR3; for (i = 0; i < psiconv_list_length(value->styles); i++) { if (!(style = psiconv_list_get(value->styles,i))) { - psiconv_warn(0,psiconv_list_length(buf),"Massive memory corruption"); + psiconv_warn(0,psiconv_buffer_length(buf),"Massive memory corruption"); res = -PSICONV_E_OTHER; goto ERROR3; } if (!style->name) { - psiconv_warn(0,psiconv_list_length(buf),"Null style name"); + psiconv_warn(0,psiconv_buffer_length(buf),"Null style name"); res = -PSICONV_E_GENERATE; goto ERROR3; } @@ -133,6 +144,10 @@ value->normal->paragraph))) goto ERROR3; } + + for (i = 0; i < psiconv_list_length(value->styles); i++) + if ((res = psiconv_write_u8(buf,0xff))) + goto ERROR3; res = -PSICONV_E_OK; ERROR3: