From: handa Date: Thu, 8 Oct 2009 11:16:04 +0000 (+0000) Subject: (read_cmap_table): Fix bug of handling X-Git-Tag: REL-0-9-11~56 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9477ef2b9bf2f9248dead4773dbafad08f23bd75;p=m17n%2Flibotf.git (read_cmap_table): Fix bug of handling seg->idDelta. (OTF_close): Free app_data before free all memories. --- diff --git a/src/otfopen.c b/src/otfopen.c index 6f137df..aacbc30 100644 --- a/src/otfopen.c +++ b/src/otfopen.c @@ -852,7 +852,7 @@ read_cmap_table (OTF *otf, OTF_TableInfo *table, enum OTF_ReaderFlag flag) if (seg->idRangeOffset == 0xFFFF) for (c = seg->startCount; c <= seg->endCount; c++) { - glyph_id = c + seg->idDelta; + glyph_id = (c + seg->idDelta) % 0x10000; cmap->unicode_table[c] = glyph_id; if (glyph_id > max_glyph_id) max_glyph_id = glyph_id; @@ -3026,6 +3026,10 @@ OTF_close (OTF *otf) if (internal_data->table_info[i].stream) free_stream (internal_data->table_info[i].stream); + for (; app_data; app_data = app_data->next) + if (app_data->data && app_data->freer) + app_data->freer (app_data->data); + while (memrec) { OTF_MemoryRecord *next = memrec->next; @@ -3036,9 +3040,6 @@ OTF_close (OTF *otf) memrec = next; } - for (; app_data; app_data = app_data->next) - if (app_data->data && app_data->freer) - app_data->freer (app_data->data); free (internal_data); } if (otf->filename)