--- psiconv/trunk/lib/psiconv/generate_driver.c 2000/12/25 00:26:53 76 +++ psiconv/trunk/lib/psiconv/generate_driver.c 2000/12/25 22:25:33 79 @@ -34,7 +34,7 @@ psiconv_warn(0,0,"Can't parse to an empty buffer!"); return -PSICONV_E_OTHER; } - if (!(*buf = psiconv_new_buffer())) + if (!(*buf = psiconv_buffer_new(0))) return -PSICONV_E_NOMEM; #if 0 @@ -69,7 +69,7 @@ return -PSICONV_E_OK; ERROR: - psiconv_free_buffer(*buf); + psiconv_buffer_free(*buf); return res; } @@ -97,7 +97,8 @@ goto ERROR2; } - if (!(extra_buf = psiconv_new_buffer())) { + /* Base offset is 0x18: 0x10 header section plus the section table offset */ + if (!(extra_buf = psiconv_buffer_new(0x14))) { res = -PSICONV_E_NOMEM; goto ERROR3; } @@ -118,7 +119,8 @@ entry->id = PSICONV_ID_APPL_ID_SECTION; - entry->offset = psiconv_list_length(extra_buf) + 0x14; + entry->offset = psiconv_buffer_length(extra_buf) + + psiconv_buffer_base_offset(extra_buf); if ((res = psiconv_list_add(section_table,entry))) goto ERROR6; if ((res=psiconv_write_application_id_section(extra_buf, @@ -126,24 +128,27 @@ goto ERROR6; entry->id = PSICONV_ID_PAGE_LAYOUT_SECTION; - entry->offset = psiconv_list_length(extra_buf) + 0x14; + entry->offset = psiconv_buffer_length(extra_buf) + + psiconv_buffer_base_offset(extra_buf); if ((res = psiconv_list_add(section_table,entry))) goto ERROR6; if ((res = psiconv_write_page_layout_section(extra_buf,value->page_sec))) goto ERROR6; entry->id = PSICONV_ID_TEXTED; - entry->offset = psiconv_list_length(extra_buf) + 0x14; + entry->offset = psiconv_buffer_length(extra_buf) + + psiconv_buffer_base_offset(extra_buf); if ((res = psiconv_list_add(section_table,entry))) goto ERROR6; if ((res = psiconv_write_texted_section(extra_buf,value->texted_sec, base_char,base_para))) goto ERROR6; - if ((res = psiconv_write_u32(buf,psiconv_list_length(extra_buf) + 0x14))) + if ((res = psiconv_write_u32(buf,psiconv_buffer_length(extra_buf) + + psiconv_buffer_base_offset(extra_buf)))) goto ERROR6; - if ((res = psiconv_list_concat(buf,extra_buf))) + if ((res = psiconv_buffer_concat(buf,extra_buf))) goto ERROR6; res = psiconv_write_section_table_section(buf,section_table); @@ -153,7 +158,7 @@ ERROR5: psiconv_free_character_layout(base_char); ERROR4: - psiconv_free_buffer(extra_buf); + psiconv_buffer_free(extra_buf); ERROR3: free(entry); ERROR2: