fix for inexistent sfnt ID in broken FOND
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
diff --git a/ChangeLog b/ChangeLog
index a943630..28723f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-02-15 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
+ * src/base/ftmac.c (FT_New_Face_From_SFNT): Check the sfnt resource
+ handle by its value instead of ResError(), fix provided by Deron
+ Kazmaier. According to Resource Manager Reference, GetResource(),
+ Get1Resource(), GetNamedResource(), Get1NamedResource()
+ and RGetResource() set noErr but returns NULL handle when they can
+ not find requested resource. These functions never return undefined
+ values, so it is sufficient to check if the handle is not NULL.
+
+ * builds/mac/ftmac.c (FT_New_Face_From_SFNT): Ditto.
+
2008-02-14 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* src/base/ftbase.c: <ftmac.c> is replaced by "ftmac.c" as other
diff --git a/builds/mac/ftmac.c b/builds/mac/ftmac.c
index b83fecb..b0b79ea 100644
--- a/builds/mac/ftmac.c
+++ b/builds/mac/ftmac.c
@@ -1207,7 +1207,7 @@ typedef short ResourceIndex;
sfnt = GetResource( FT_MAKE_TAG( 's', 'f', 'n', 't' ), sfnt_id );
- if ( ResError() )
+ if ( sfnt == NULL )
return FT_Err_Invalid_Handle;
sfnt_size = (FT_ULong)GetHandleSize( sfnt );
diff --git a/src/base/ftmac.c b/src/base/ftmac.c
index 1b9ffe9..8aa08c3 100644
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -828,7 +828,7 @@ typedef short ResourceIndex;
sfnt = GetResource( FT_MAKE_TAG( 's', 'f', 'n', 't' ), sfnt_id );
- if ( ResError() )
+ if ( sfnt == NULL )
return FT_Err_Invalid_Handle;
sfnt_size = (FT_ULong)GetHandleSize( sfnt );