* src/base/ftrfork.c: add support for new pathname syntax "..namedfork/rsrc" to access resource fork on Mac OS X.

This commit is contained in:
Suzuki, Toshiya (鈴木俊哉) 2007-12-06 10:27:15 +00:00
parent 44b5e57781
commit a6d36573bd
3 changed files with 78 additions and 23 deletions

View File

@ -1,3 +1,14 @@
2007-12-06 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* src/base/ftrfork.c (raccess_guess_darwin_newvfs): New function
to support new pathname syntax "..namedfork/rsrc" to access
a resource fork on Mac OS X. The legacy syntax "/rsrc" does not
work on case-sensitive HFS+.
(raccess_guess_darwin_hfsplus): Fix a bug in the calculation of
buffer size to store a pathname.
* include/freetype/internal/ftrfork.h: Increment the number of
resource fork guessing rule.
2007-12-06 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* builds/unix/configure.raw: improve the compile tests to search

View File

@ -34,7 +34,7 @@ FT_BEGIN_HEADER
/* Number of guessing rules supported in `FT_Raccess_Guess'. */
/* Don't forget to increment the number if you add a new guessing rule. */
#define FT_RACCESS_N_RULES 8
#define FT_RACCESS_N_RULES 9
/*************************************************************************/

View File

@ -253,6 +253,13 @@
char **result_file_name,
FT_Long *result_offset );
static FT_Error
raccess_guess_darwin_newvfs( FT_Library library,
FT_Stream stream,
char *base_file_name,
char **result_file_name,
FT_Long *result_offset );
static FT_Error
raccess_guess_darwin_hfsplus( FT_Library library,
FT_Stream stream,
@ -329,6 +336,7 @@
raccess_guess_apple_double,
raccess_guess_apple_single,
raccess_guess_darwin_ufs_export,
raccess_guess_darwin_newvfs,
raccess_guess_darwin_hfsplus,
raccess_guess_vfat,
raccess_guess_linux_cap,
@ -443,7 +451,7 @@
memory = library->memory;
if ( base_file_len > FT_INT_MAX )
if ( base_file_len + 6 > FT_INT_MAX )
return FT_Err_Array_Too_Large;
if ( FT_ALLOC( newpath, base_file_len + 6 ) )
@ -459,6 +467,42 @@
}
static FT_Error
raccess_guess_darwin_newvfs( FT_Library library,
FT_Stream stream,
char *base_file_name,
char **result_file_name,
FT_Long *result_offset )
{
/*
Only meaningful on systems with Mac OS X (> 10.1).
*/
FT_Error error;
char* newpath;
FT_Memory memory;
FT_Long base_file_len = ft_strlen( base_file_name );
FT_UNUSED( stream );
memory = library->memory;
if ( base_file_len + 18 > FT_INT_MAX )
return FT_Err_Array_Too_Large;
if ( FT_ALLOC( newpath, base_file_len + 18 ) )
return error;
FT_MEM_COPY( newpath, base_file_name, base_file_len );
FT_MEM_COPY( newpath + base_file_len, "/..namedfork/rsrc", 18 );
*result_file_name = newpath;
*result_offset = 0;
return FT_Err_Ok;
}
static FT_Error
raccess_guess_vfat( FT_Library library,
FT_Stream stream,