--- psiconv/trunk/lib/psiconv/parse_layout.c 2004/01/04 15:47:16 181 +++ psiconv/trunk/lib/psiconv/parse_layout.c 2004/01/04 22:07:02 182 @@ -80,40 +80,38 @@ int *length, psiconv_font *result) { int res = 0; - int strlength,i; char *str_copy; - int len; + int len=0; + int leng; 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); + (*result)->name = psiconv_read_short_string(config,buf,lev+2,off+len, + &leng,&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); - if (res) - goto ERROR3; - (*result)->name[strlength-1] = 0; - (*result)->screenfont = psiconv_read_u8(config,buf,lev+2,off + strlength,&res); + len += leng; + + (*result)->screenfont = psiconv_read_u8(config,buf,lev+2,off+len,&res); if (res) goto ERROR3; if (!(str_copy = psiconv_make_printable((*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: