summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsuzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>2010-10-13 17:20:27 +0900
committersuzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>2010-10-13 17:20:27 +0900
commit463dddadfbc4a5d28b7983c69ddd840b72519325 (patch)
treef640845d7bd6789c8501bddd28fc05c6870046da
parentc081a4a932503daa6d1d969e62611215d28c5445 (diff)
downloadfreetype2-463dddadfbc4a5d28b7983c69ddd840b72519325.tar.gz
[raccess] Skip unrequired resource access rules by Darwin VFS.
When a resource fork access rule by Darwin VFS could open the resource fork but no font is found in it, the rest of rules by Darwin VFS are skipped. It reduces the warnings of the deprecated resource fork access method by recent Darwin kernel. Fix MacPorts ticket #18859: http://trac.macports.org/ticket/18859 * src/base/ftobjs.c (load_face_in_embedded_rfork): When FT_Stream_New() returns FT_Err_Cannot_Open_Stream, it means that the file is possible to be fopen()-ed but zero-sized. Also there is a case that the resource fork is not zero-sized, but no supported font exists in it. If a rule by Darwin VFS falls into such cases, there is no need to try other Darwin VFS rules anymore. Such cases are marked by vfs_rfork_has_no_font. If it is TRUE, the Darwin VFS rules are skipped.
-rw-r--r--ChangeLog20
-rw-r--r--src/base/ftobjs.c15
2 files changed, 35 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d2ebebc1e..d6faede19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
2010-10-13 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+ [raccess] Skip unrequired resource access rules by Darwin VFS.
+
+ When a resource fork access rule by Darwin VFS could open the
+ resource fork but no font is found in it, the rest of rules
+ by Darwin VFS are skipped. It reduces the warnings of the
+ deprecated resource fork access method by recent Darwin kernel.
+ Fix MacPorts ticket #18859:
+ http://trac.macports.org/ticket/18859
+
+ * src/base/ftobjs.c (load_face_in_embedded_rfork):
+ When FT_Stream_New() returns FT_Err_Cannot_Open_Stream, it
+ means that the file is possible to be fopen()-ed but zero-sized.
+ Also there is a case that the resource fork is not zero-sized,
+ but no supported font exists in it. If a rule by Darwin VFS
+ falls into such cases, there is no need to try other Darwin VFS
+ rules anymore. Such cases are marked by vfs_rfork_has_no_font.
+ If it is TRUE, the Darwin VFS rules are skipped.
+
+2010-10-13 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
[raccess] Grouping resource access rules based on Darwin VFS.
MacOS X/Darwin kernel supports a few tricky methods to access
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 7f38df0cb..d12a71bb6 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1849,6 +1849,7 @@
char * file_names[FT_RACCESS_N_RULES];
FT_Long offsets[FT_RACCESS_N_RULES];
FT_Error errors[FT_RACCESS_N_RULES];
+ FT_Bool is_darwin_vfs, vfs_rfork_has_no_font = FALSE; /* not tested */
FT_Open_Args args2;
FT_Stream stream2 = 0;
@@ -1859,6 +1860,15 @@
for ( i = 0; i < FT_RACCESS_N_RULES; i++ )
{
+ is_darwin_vfs = raccess_rule_by_darwin_vfs( i );
+ if ( is_darwin_vfs && vfs_rfork_has_no_font )
+ {
+ FT_TRACE3(( "Skip rule %d: darwin vfs resource fork"
+ " is already checked and"
+ " no font is found\n", i ));
+ continue;
+ }
+
if ( errors[i] )
{
FT_TRACE3(( "Error[%d] has occurred in rule %d\n", errors[i], i ));
@@ -1872,6 +1882,9 @@
i, args2.pathname, offsets[i] ));
error = FT_Stream_New( library, &args2, &stream2 );
+ if ( is_darwin_vfs && error == FT_Err_Cannot_Open_Stream )
+ vfs_rfork_has_no_font = TRUE;
+
if ( error )
{
FT_TRACE3(( "failed\n" ));
@@ -1886,6 +1899,8 @@
if ( !error )
break;
+ else if ( is_darwin_vfs )
+ vfs_rfork_has_no_font = TRUE;
}
for (i = 0; i < FT_RACCESS_N_RULES; i++)