--- psiconv/trunk/lib/psiconv/parse_layout.c 2003/11/25 17:57:05 168 +++ psiconv/trunk/lib/psiconv/parse_layout.c 2004/01/06 20:15:01 184 @@ -64,7 +64,7 @@ ERROR2: free(*result); ERROR1: - psiconv_warn(config,lev+1,off,"Reading of Color failed"); + psiconv_error(config,lev+1,off,"Reading of Color failed"); if (length) *length = 0; if (res == 0) @@ -80,40 +80,42 @@ int *length, psiconv_font *result) { int res = 0; - int strlength,i; char *str_copy; - int len; + int len=0; + int fontlen; psiconv_progress(config,lev+1,off,"Going to parse font"); if (!(*result = malloc(sizeof(**result)))) goto ERROR1; - strlength = psiconv_read_u8(config,buf,lev+2,off,&res); + fontlen = psiconv_read_u8(config,buf,lev+2,off,&res); if (res) goto ERROR2; - if (!((*result)->name = malloc(strlength))) { - goto ERROR2; - } - for (i = 0; (i < strlength-1) && !res; i++) - (*result)->name[i] = psiconv_read_u8(config,buf,lev+2,off + 1 + i,&res); + len = 1; + + (*result)->name = psiconv_read_charlist(config,buf,lev+2,off, fontlen-1,&res); if (res) - goto ERROR3; - (*result)->name[strlength-1] = 0; - (*result)->screenfont = psiconv_read_u8(config,buf,lev+2,off + strlength,&res); + goto ERROR2; + len += fontlen - 1; + + (*result)->screenfont = psiconv_read_u8(config,buf,lev+2,off+len,&res); if (res) goto ERROR3; - if (!(str_copy = psiconv_make_printable((*result)->name))) + if (!(str_copy = psiconv_make_printable(config,(*result)->name))) goto ERROR3; - psiconv_debug(config,lev+2,off+1,"Found font `%s', displayed with screen font %02x", + psiconv_debug(config,lev+2,off+len, + "Found font `%s', displayed with screen font %02x", str_copy,(*result)->screenfont); free(str_copy); - len = strlength + 1; + len ++; + if (length) *length = len; - psiconv_progress(config,lev+1,off + len - 1,"End of font (total length: %08x)",len); + psiconv_progress(config,lev+1,off + len - 1, + "End of font (total length: %08x)",len); return 0; ERROR3: @@ -121,7 +123,7 @@ ERROR2: free (*result); ERROR1: - psiconv_warn(config,lev+1,off,"Reading of Font failed"); + psiconv_error(config,lev+1,off,"Reading of Font failed"); if (length) *length = 0; if (!res) @@ -216,7 +218,7 @@ ERROR2: free (result); ERROR1: - psiconv_warn(config,lev+1,off,"Reading of Border failed"); + psiconv_error(config,lev+1,off,"Reading of Border failed"); if (length) *length = 0; if (!res) @@ -233,6 +235,7 @@ int len = 0; int leng; int bullet_length; + psiconv_u8 temp; if (!(*result = malloc(sizeof(**result)))) goto ERROR1; @@ -253,9 +256,10 @@ len +=leng; psiconv_progress(config,lev+2,off+len,"Going to read bullet character"); - (*result)->character = psiconv_read_u8(config,buf,lev+2,off+len,&res); + temp = psiconv_read_u8(config,buf,lev+2,off+len,&res); if (res) goto ERROR2; + (*result)->character = psiconv_unicode_from_char(config,temp); psiconv_debug(config,lev+2,off+len,"Character: %02x",(*result)->character); len ++; @@ -293,7 +297,7 @@ ERROR2: free (result); ERROR1: - psiconv_warn(config,lev+1,off,"Reading of Bullet failed"); + psiconv_error(config,lev+1,off,"Reading of Bullet failed"); if (length) *length = 0; if (!res) @@ -349,7 +353,7 @@ ERROR2: free (result); ERROR1: - psiconv_warn(config,lev+1,off,"Reading of Tab failed"); + psiconv_error(config,lev+1,off,"Reading of Tab failed"); if (length) *length = 0; if (!res) @@ -604,8 +608,8 @@ } if (len - 4 != list_length) { - psiconv_warn(config,lev+2,off+len, - "Read past end of paragraph layout codes list. I probably lost track" + psiconv_error(config,lev+2,off+len, + "Read past end of paragraph layout codes list. I probably lost track " "somewhere!"); psiconv_debug(config,lev+2,off+len,"Read %d characters instead of %d", len-4,list_length); @@ -623,7 +627,7 @@ return 0; ERROR1: - psiconv_warn(config,lev+1,off,"Reading of paragraph_layout_list failed"); + psiconv_error(config,lev+1,off,"Reading of paragraph_layout_list failed"); if (length) *length = 0; if (!res) @@ -773,8 +777,8 @@ } if (len - 4 != list_length) { - psiconv_warn(config,lev+2,off+len, - "Read past end of character layout codes list. I probably lost track" + psiconv_error(config,lev+2,off+len, + "Read past end of character layout codes list. I probably lost track " "somewhere!"); psiconv_debug(config,lev+2,off+len,"Read %d characters instead of %d", len-4,list_length); @@ -792,7 +796,7 @@ return res; ERROR1: - psiconv_warn(config,lev+1,off,"Reading of character_layout_list failed"); + psiconv_error(config,lev+1,off,"Reading of character_layout_list failed"); if (length) *length = 0; if (!res)