--- psiconv/trunk/lib/psiconv/parse_common.c 2004/02/22 22:24:39 217 +++ psiconv/trunk/lib/psiconv/parse_common.c 2005/11/15 15:52:34 270 @@ -1,6 +1,6 @@ /* parse_common.c - Part of psiconv, a PSION 5 file formats converter - Copyright (c) 1999-2004 Frodo Looijaard + Copyright (c) 1999-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 @@ -279,10 +279,9 @@ psiconv_paragraph para; psiconv_ucs2 temp; psiconv_list line; - psiconv_ucs2 *nextcharptr; int nr; - int i,j,leng; + int i,leng; char *str_copy; psiconv_progress(config,lev+1,off,"Going to parse the text section"); @@ -314,17 +313,8 @@ goto ERROR4; } if ((temp == 0x06) || (i + leng == text_len)) { - if (!(para->text = malloc(sizeof(*(para->text)) * - (psiconv_list_length(line) + 1)))) + if (!(para->text = psiconv_unicode_from_list(line))) goto ERROR4; - for (j = 0; j < psiconv_list_length(line); j++) { - if (!(nextcharptr = psiconv_list_get(line,j))) { - psiconv_error(config,lev+2,off+i+len,"Internal data corruption"); - goto ERROR5; - } - para->text[j] = *nextcharptr; - } - para->text[j] = 0; if (!(str_copy = psiconv_make_printable(config,para->text))) goto ERROR5; @@ -580,7 +570,7 @@ psiconv_debug(config,lev+4,off+len,"Type: %02x",temp); for (j = 0; j < psiconv_list_length(anon_styles); j++) { if (!(anon_ptr = psiconv_list_get(anon_styles,j))) { - psiconv_error(config,lev+4,off+len,"Massive memory curruption"); + psiconv_error(config,lev+4,off+len,"Data structure corruption"); goto ERROR4; } if (temp == anon_ptr->nr) @@ -686,7 +676,7 @@ total = 0; for (i = 0; i < psiconv_list_length(result); i++) { if (!(para = psiconv_list_get(result,i))) { - psiconv_error(config,lev+3,off+len,"Massive memory corruption"); + psiconv_error(config,lev+3,off+len,"Data structure corruption"); goto ERROR4; } line_length = -1; @@ -791,7 +781,7 @@ for (i = 0 ; i < psiconv_list_length(anon_styles); i ++) { if (!(anon_ptr = psiconv_list_get(anon_styles,i))) { - psiconv_error(config,lev+4,off+len,"Massive memory corruption"); + psiconv_error(config,lev+4,off+len,"Data structure corruption"); goto ERROR2; } psiconv_free_character_layout(anon_ptr->character); @@ -833,7 +823,7 @@ ERROR3: for (i = 0; i < psiconv_list_length(anon_styles); i++) { if (!(anon_ptr = psiconv_list_get(anon_styles,i))) { - psiconv_error(config,lev+1,off,"Massive memory corruption"); + psiconv_error(config,lev+1,off,"Data structure corruption"); break; } psiconv_free_paragraph_layout(anon_ptr->paragraph); @@ -1236,7 +1226,6 @@ (*result)->icon_name = psiconv_read_string(config,buf,lev+2,off+len,&leng,&res); if (res) goto ERROR2; - psiconv_debug(config,lev+2,off+len,"Icon name: %s",(*result)->icon_name); len += leng; psiconv_progress(config,lev+2,off+len,"Going to read the icon width");