diff options
author | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2011-01-06 12:24:43 +0900 |
---|---|---|
committer | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2011-01-10 00:43:39 +0900 |
commit | b440828b6c74b663b3438248974d1cafcb4bdcc6 (patch) | |
tree | 87a339dda2af9cd436a32ec1382432ed7aa46ab2 | |
parent | 8967a174cdf351bb962498289545e056cd070445 (diff) | |
download | freetype2-b440828b6c74b663b3438248974d1cafcb4bdcc6.tar.gz |
use cpp-macro PLATFORM_PATH_SEPARATOR instead of raw ascii slash
-rw-r--r-- | builds/unix/ftconfig.in | 20 | ||||
-rw-r--r-- | include/freetype/config/ftconfig.h | 19 | ||||
-rw-r--r-- | src/base/ftrfork.c | 19 |
3 files changed, 52 insertions, 6 deletions
diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in index 4c81187e5..85bde304a 100644 --- a/builds/unix/ftconfig.in +++ b/builds/unix/ftconfig.in @@ -167,6 +167,26 @@ FT_BEGIN_HEADER #endif + /*************************************************************************/ + /* */ + /* Pathname separator used by resource-fork accessor & ft_basename() */ + /* */ + +#ifdef PLATFORM_PATH_SEPARATOR + /* explicitly defined, do nothing */ +#elif defined( __DOS__ ) || defined( __OS2__ ) || defined( _WIN32 ) || \ + defined( __SYMBIAN32__ ) +#define PLATFORM_PATH_SEPARATOR "\\" +#elif defined( FT_MACINTOSH ) && !defined( __MACH__ ) +#define PLATFORM_PATH_SEPARATOR ":" +#elif defined( __riscos__ ) || defined( VMS ) +#define PLATFORM_PATH_SEPARATOR "." +#else +#define PLATFORM_PATH_SEPARATOR "/" +#endif + + + /* Fix compiler warning with sgi compiler */ #if defined( __sgi ) && !defined( __GNUC__ ) #if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 ) diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index cbe30f268..de7d654a2 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -147,6 +147,25 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ + /* Pathname separator used by resource-fork accessor & ft_basename() */ + /* */ + +#ifdef PLATFORM_PATH_SEPARATOR + /* explicitly defined, do nothing */ +#elif defined( __DOS__ ) || defined( __OS2__ ) || defined( _WIN32 ) || \ + defined( __SYMBIAN32__ ) +#define PLATFORM_PATH_SEPARATOR "\\" +#elif defined( FT_MACINTOSH ) && !defined( __MACH__ ) +#define PLATFORM_PATH_SEPARATOR ":" +#elif defined( __riscos__ ) || defined( VMS ) +#define PLATFORM_PATH_SEPARATOR "." +#else +#define PLATFORM_PATH_SEPARATOR "/" +#endif + + + /*************************************************************************/ + /* */ /* <Section> */ /* basic_types */ /* */ diff --git a/src/base/ftrfork.c b/src/base/ftrfork.c index b01ecb9f9..819aa01af 100644 --- a/src/base/ftrfork.c +++ b/src/base/ftrfork.c @@ -544,7 +544,8 @@ return error; FT_MEM_COPY( newpath, base_file_name, base_file_len ); - FT_MEM_COPY( newpath + base_file_len, "/rsrc", 6 ); + FT_MEM_COPY( newpath + base_file_len, + PLATFORM_PATH_SEPARATOR "rsrc", 6 ); *result_file_name = newpath; *result_offset = 0; @@ -580,7 +581,9 @@ return error; FT_MEM_COPY( newpath, base_file_name, base_file_len ); - FT_MEM_COPY( newpath + base_file_len, "/..namedfork/rsrc", 18 ); + FT_MEM_COPY( newpath + base_file_len, + PLATFORM_PATH_SEPARATOR "..namedfork" + PLATFORM_PATH_SEPARATOR "rsrc", 18 ); *result_file_name = newpath; *result_offset = 0; @@ -605,7 +608,8 @@ memory = library->memory; newpath = raccess_make_file_name( memory, base_file_name, - "resource.frk/" ); + "resource.frk" + PLATFORM_PATH_SEPARATOR ); if ( !newpath ) return FT_Err_Out_Of_Memory; @@ -631,7 +635,9 @@ memory = library->memory; - newpath = raccess_make_file_name( memory, base_file_name, ".resource/" ); + newpath = raccess_make_file_name( memory, base_file_name, + ".resource" + PLATFORM_PATH_SEPARATOR ); if ( !newpath ) return FT_Err_Out_Of_Memory; @@ -690,7 +696,8 @@ memory = library->memory; newpath = raccess_make_file_name( memory, base_file_name, - ".AppleDouble/" ); + ".AppleDouble" + PLATFORM_PATH_SEPARATOR ); if ( !newpath ) return FT_Err_Out_Of_Memory; @@ -815,7 +822,7 @@ if ( FT_ALLOC( new_name, new_length + 1 ) ) return NULL; - tmp = ft_strrchr( original_name, '/' ); + tmp = ft_strrchr( original_name, PLATFORM_PATH_SEPARATOR[0] ); if ( tmp ) { ft_strncpy( new_name, original_name, tmp - original_name + 1 ); |