* src/base/ftmac.c: Use more abstract data type instead of `short\'
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 283 284 285 286 287 288 289 290 291 292 293
diff --git a/ChangeLog b/ChangeLog
index 8b8eae9..f7041e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-08-29 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
+ * src/base/ftmac.c: Introduction of abstract "short" data types,
+ ResFileRefNum and ResID. These types were introduced for Copland,
+ then backported to MPW. The variables exchanged with FileManager
+ QuickDraw frameworks are redefined by these data types. Patch was
+ proposed by Sean McBride.
+ * builds/mac/ftmac.c: Ditto.
+
2007-08-18 Werner Lemberg <wl@gnu.org>
* src/otvalid/otvcmmn.c (otv_x_y_ux_sy): Skip context glyphs. Found
diff --git a/builds/mac/ftmac.c b/builds/mac/ftmac.c
index 445ff9a..0f44fc5 100644
--- a/builds/mac/ftmac.c
+++ b/builds/mac/ftmac.c
@@ -360,7 +360,7 @@
#endif /* HAVE_ATS */
-#if !HAVE_FSSPEC
+#if !HAVE_FSSPEC || !HAVE_ATS
FT_EXPORT_DEF( FT_Error )
FT_GetFile_From_Mac_ATS_Name( const char* fontName,
@@ -437,6 +437,7 @@
#if HAVE_FSSPEC && !HAVE_FSREF
+ /* isDirectory is a dummy to synchronize API with FSPathMakeRef() */
static OSErr
FT_FSPathMakeSpec( const UInt8* pathname,
FSSpec* spec_p,
@@ -447,6 +448,7 @@
long dirID;
Str255 nodeName;
OSErr err;
+ FT_UNUSED( isDirectory );
p = q = (const char *)pathname;
@@ -534,8 +536,8 @@
static OSErr
- FT_FSPathMakeRes( const UInt8* pathname,
- short* res )
+ FT_FSPathMakeRes( const UInt8* pathname,
+ ResFileRefNum* res )
{
#if HAVE_FSREF
@@ -690,7 +692,7 @@
static void
parse_fond( char* fond_data,
short* have_sfnt,
- short* sfnt_id,
+ ResID* sfnt_id,
Str255 lwfn_file_name,
short face_index )
{
@@ -882,7 +884,7 @@
count_faces( Handle fond,
const UInt8* pathname )
{
- short sfnt_id;
+ ResID sfnt_id;
short have_sfnt, have_lwfn;
Str255 lwfn_file_name;
UInt8 buff[HFS_MAXPATHLEN];
@@ -919,13 +921,13 @@
chunks are often not organized that way, so we glue chunks
of the same type together. */
static FT_Error
- read_lwfn( FT_Memory memory,
- short res,
- FT_Byte** pfb_data,
- FT_ULong* size )
+ read_lwfn( FT_Memory memory,
+ ResFileRefNum res,
+ FT_Byte** pfb_data,
+ FT_ULong* size )
{
FT_Error error = FT_Err_Ok;
- short res_id;
+ ResID res_id;
unsigned char *buffer, *p, *size_p = NULL;
FT_ULong total_size = 0;
FT_ULong old_total_size = 0;
@@ -1144,10 +1146,10 @@
FT_Long face_index,
FT_Face* aface )
{
- FT_Byte* pfb_data;
- FT_ULong pfb_size;
- FT_Error error;
- short res;
+ FT_Byte* pfb_data;
+ FT_ULong pfb_size;
+ FT_Error error;
+ ResFileRefNum res;
if ( noErr != FT_FSPathMakeRes( pathname, &res ) )
@@ -1172,7 +1174,7 @@
/* Create a new FT_Face from an SFNT resource, specified by res ID. */
static FT_Error
FT_New_Face_From_SFNT( FT_Library library,
- short sfnt_id,
+ ResID sfnt_id,
FT_Long face_index,
FT_Face* aface )
{
@@ -1221,10 +1223,11 @@
FT_Long face_index,
FT_Face* aface )
{
- FT_Error error = FT_Err_Cannot_Open_Resource;
- short res_ref, res_index;
- Handle fond;
- short num_faces_in_res, num_faces_in_fond;
+ FT_Error error = FT_Err_Cannot_Open_Resource;
+ ResFileRefNum res_ref;
+ short res_index;
+ Handle fond;
+ short num_faces_in_res, num_faces_in_fond;
if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) )
@@ -1265,8 +1268,8 @@
FT_Long face_index,
FT_Face* aface )
{
- short sfnt_id, have_sfnt, have_lwfn = 0;
- short fond_id;
+ short have_sfnt, have_lwfn = 0;
+ ResID sfnt_id, fond_id;
OSType fond_type;
Str255 fond_name;
Str255 lwfn_file_name;
@@ -1285,7 +1288,7 @@
if ( lwfn_file_name[0] )
{
- short res;
+ ResFileRefNum res;
res = HomeResFile( fond );
diff --git a/src/base/ftmac.c b/src/base/ftmac.c
index c321f4d..ba56235 100644
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -100,6 +100,7 @@
#endif
+ /* This function is deprecated because FSSpec is deprecated in Mac OS X */
FT_EXPORT_DEF( FT_Error )
FT_GetFile_From_Mac_Name( const char* fontName,
FSSpec* pathSpec,
@@ -239,8 +240,8 @@
static OSErr
- FT_FSPathMakeRes( const UInt8* pathname,
- short* res )
+ FT_FSPathMakeRes( const UInt8* pathname,
+ ResFileRefNum* res )
{
OSErr err;
FSRef ref;
@@ -357,7 +358,7 @@
static void
parse_fond( char* fond_data,
short* have_sfnt,
- short* sfnt_id,
+ ResID* sfnt_id,
Str255 lwfn_file_name,
short face_index )
{
@@ -463,8 +464,8 @@
UInt8* path_lwfn,
size_t path_size )
{
- FSRef ref, par_ref;
- int dirname_len;
+ FSRef ref, par_ref;
+ size_t dirname_len;
/* Pathname for FSRef can be in various formats: HFS, HFS+, and POSIX. */
@@ -504,7 +505,7 @@
count_faces( Handle fond,
const UInt8* pathname )
{
- short sfnt_id;
+ ResID sfnt_id;
short have_sfnt, have_lwfn;
Str255 lwfn_file_name;
UInt8 buff[HFS_MAXPATHLEN];
@@ -539,13 +540,13 @@
chunks are often not organized that way, so we glue chunks
of the same type together. */
static FT_Error
- read_lwfn( FT_Memory memory,
- short res,
- FT_Byte** pfb_data,
- FT_ULong* size )
+ read_lwfn( FT_Memory memory,
+ ResFileRefNum res,
+ FT_Byte** pfb_data,
+ FT_ULong* size )
{
FT_Error error = FT_Err_Ok;
- short res_id;
+ ResID res_id;
unsigned char *buffer, *p, *size_p = NULL;
FT_ULong total_size = 0;
FT_ULong old_total_size = 0;
@@ -764,10 +765,10 @@
FT_Long face_index,
FT_Face* aface )
{
- FT_Byte* pfb_data;
- FT_ULong pfb_size;
- FT_Error error;
- short res;
+ FT_Byte* pfb_data;
+ FT_ULong pfb_size;
+ FT_Error error;
+ ResFileRefNum res;
if ( noErr != FT_FSPathMakeRes( pathname, &res ) )
@@ -792,7 +793,7 @@
/* Create a new FT_Face from an SFNT resource, specified by res ID. */
static FT_Error
FT_New_Face_From_SFNT( FT_Library library,
- short sfnt_id,
+ ResID sfnt_id,
FT_Long face_index,
FT_Face* aface )
{
@@ -839,10 +840,11 @@
FT_Long face_index,
FT_Face* aface )
{
- FT_Error error = FT_Err_Cannot_Open_Resource;
- short res_ref, res_index;
- Handle fond;
- short num_faces_in_res, num_faces_in_fond;
+ FT_Error error = FT_Err_Cannot_Open_Resource;
+ ResFileRefNum res_ref;
+ short res_index;
+ Handle fond;
+ short num_faces_in_res, num_faces_in_fond;
if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) )
@@ -883,8 +885,8 @@
FT_Long face_index,
FT_Face* aface )
{
- short sfnt_id, have_sfnt, have_lwfn = 0;
- short fond_id;
+ short have_sfnt, have_lwfn = 0;
+ ResID sfnt_id, fond_id;
OSType fond_type;
Str255 fond_name;
Str255 lwfn_file_name;
@@ -901,7 +903,7 @@
if ( lwfn_file_name[0] )
{
- short res;
+ ResFileRefNum res;
res = HomeResFile( fond );
@@ -1068,6 +1070,7 @@
/* FT_New_Face_From_FSSpec is identical to FT_New_Face except it */
/* accepts an FSSpec instead of a path. */
/* */
+ /* This function is deprecated because FSSpec is deprecated in Mac OS X */
FT_EXPORT_DEF( FT_Error )
FT_New_Face_From_FSSpec( FT_Library library,
const FSSpec* spec,