diff --git a/ChangeLog b/ChangeLog index d2ebebc1e..d6faede19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2010-10-13 suzuki toshiya + + [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 [raccess] Grouping resource access rules based on Darwin VFS. 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++)