* src/base/ftrfork.c: add support for new pathname syntax "..namedfork/rsrc" to access resource fork on Mac OS X.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
diff --git a/ChangeLog b/ChangeLog
index db14450..c2a3040 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
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
Carbon functions.
* builds/mac/ftmac.c: import fixes for Carbon incompatibilities
diff --git a/include/freetype/internal/ftrfork.h b/include/freetype/internal/ftrfork.h
index 94402bc..a4ddedc 100644
--- a/include/freetype/internal/ftrfork.h
+++ b/include/freetype/internal/ftrfork.h
@@ -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
/*************************************************************************/
diff --git a/src/base/ftrfork.c b/src/base/ftrfork.c
index 120c2f8..4e32fba 100644
--- a/src/base/ftrfork.c
+++ b/src/base/ftrfork.c
@@ -227,7 +227,7 @@
typedef FT_Error
(*raccess_guess_func)( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset );
@@ -235,56 +235,63 @@
static FT_Error
raccess_guess_apple_double( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset );
static FT_Error
raccess_guess_apple_single( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset );
static FT_Error
raccess_guess_darwin_ufs_export( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
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,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset );
static FT_Error
raccess_guess_vfat( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset );
static FT_Error
raccess_guess_linux_cap( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset );
static FT_Error
raccess_guess_linux_double( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset );
static FT_Error
raccess_guess_linux_netatalk( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset );
@@ -298,7 +305,7 @@
static FT_Error
raccess_guess_apple_generic( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
FT_Int32 magic,
FT_Long *result_offset );
@@ -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,
@@ -358,7 +366,7 @@
static FT_Error
raccess_guess_apple_double( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset )
{
@@ -377,7 +385,7 @@
static FT_Error
raccess_guess_apple_single( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset )
{
@@ -396,7 +404,7 @@
static FT_Error
raccess_guess_darwin_ufs_export( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset )
{
@@ -426,7 +434,7 @@
static FT_Error
raccess_guess_darwin_hfsplus( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset )
{
@@ -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 ) )
@@ -460,9 +468,45 @@
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,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset )
{
@@ -489,7 +533,7 @@
static FT_Error
raccess_guess_linux_cap( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset )
{
@@ -515,7 +559,7 @@
static FT_Error
raccess_guess_linux_double( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset )
{
@@ -546,7 +590,7 @@
static FT_Error
raccess_guess_linux_netatalk( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
char **result_file_name,
FT_Long *result_offset )
{
@@ -578,7 +622,7 @@
static FT_Error
raccess_guess_apple_generic( FT_Library library,
FT_Stream stream,
- char * base_file_name,
+ char *base_file_name,
FT_Int32 magic,
FT_Long *result_offset )
{
@@ -639,7 +683,7 @@
static FT_Error
raccess_guess_linux_double_from_file_name( FT_Library library,
- char * file_name,
+ char *file_name,
FT_Long *result_offset )
{
FT_Open_Args args2;
@@ -711,7 +755,7 @@
FT_BASE_DEF( void )
FT_Raccess_Guess( FT_Library library,
FT_Stream stream,
- char* base_name,
+ char *base_name,
char **new_names,
FT_Long *offsets,
FT_Error *errors )