Commit c6a92202c23b916536903921401e6289f8b66ca2

David Turner 2000-07-04T18:12:13

various clean-ups: - using FT_UNUSED instead of UNUSED - using FT_LONG64 and FT_INT64 instead of LONG64 & INT64 - using FT_SIZEOF_INT & FT_SIZEOF_LONG instead of... - removed the #ifdefs that used SIZEOF_INT, instead we now use FT_Int32 and FT_UInt32 when needed to support 32-bits quantity correctly on 64-bits systems..

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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
diff --git a/config/unix/ftconfig.in b/config/unix/ftconfig.in
index de09805..c61ab26 100644
--- a/config/unix/ftconfig.in
+++ b/config/unix/ftconfig.in
@@ -59,10 +59,10 @@
 #undef STDC_HEADERS
 
 /* the number of bytes in an `int' type. */
-#define SIZEOF_INT  4
+#define FT_SIZEOF_INT  4
 
 /* the number of bytes in a `long' type. */
-#define SIZEOF_LONG 4
+#define FT_SIZEOF_LONG 4
 
 /* Define if you have the memcpy function.  */
 #undef HAVE_MEMCPY
@@ -99,12 +99,12 @@
   typedef signed short    FT_Int16;
   typedef unsigned short  FT_Word16;
 
-#if SIZEOF_INT == 4
+#if FT_SIZEOF_INT == 4
 
   typedef signed int      FT_Int32;
   typedef unsigned int    FT_Word32;
 
-#elif SIZEOF_LONG == 4
+#elif FT_SIZEOF_LONG == 4
 
   typedef signed long     FT_Int32;
   typedef unsigned long   FT_Word32;
@@ -113,11 +113,11 @@
 #error "no 32bit type found - please check your configuration files"
 #endif
 
-#if SIZEOF_LONG == 8
+#if FT_SIZEOF_LONG == 8
 
   /* LONG64 must be defined when a 64-bit type is available */
-#define LONG64
-#define INT64   long
+#define FT_LONG64
+#define FT_INT64   long
 
 #else
 
@@ -132,8 +132,8 @@
   /*                                                                       */
 #ifdef FTCALC_USE_LONG_LONG
 
-#define LONG64
-#define INT64   long long
+#define FT_LONG64
+#define FT_INT64   long long
 
 #endif /* FTCALC_USE_LONG_LONG */
 #endif
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index cd598d8..64506fc 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -63,20 +63,20 @@
 
 /* The number of bytes in an `int' type.  */
 #if   UINT_MAX == 0xFFFFFFFF
-#define SIZEOF_INT  4
+#define FT_SIZEOF_INT  4
 #elif UINT_MAX == 0xFFFF
-#define SIZEOF_INT  2
+#define FT_SIZEOF_INT  2
 #elif UINT_MAX > 0xFFFFFFFF && UINT_MAX == 0xFFFFFFFFFFFFFFFF
-#define SIZEOF_INT  8
+#define FT_SIZEOF_INT  8
 #else
 #error "Unsupported number of bytes in `int' type!"
 #endif
 
 /* The number of bytes in a `long' type.  */
 #if   ULONG_MAX == 0xFFFFFFFF
-#define SIZEOF_LONG  4
+#define FT_SIZEOF_LONG  4
 #elif ULONG_MAX > 0xFFFFFFFF && ULONG_MAX == 0xFFFFFFFFFFFFFFFF
-#define SIZEOF_LONG  8
+#define FT_SIZEOF_LONG  8
 #else
 #error "Unsupported number of bytes in `long' type!"
 #endif
@@ -97,8 +97,8 @@
 
 /* UNUSED is a macro used to indicate that a given parameter is not used */
 /* this is only used to get rid of unpleasant compiler warnings..        */
-#ifndef UNUSED
-#define UNUSED( arg )  ( (arg)=(arg) )
+#ifndef FT_UNUSED
+#define FT_UNUSED( arg )  ( (arg)=(arg) )
 #endif
 
 
@@ -123,12 +123,12 @@
   typedef signed short    FT_Int16;
   typedef unsigned short  FT_Word16;
 
-#if SIZEOF_INT == 4
+#if FT_SIZEOF_INT == 4
 
   typedef signed int      FT_Int32;
   typedef unsigned int    FT_Word32;
 
-#elif SIZEOF_LONG == 4
+#elif FT_SIZEOF_LONG == 4
 
   typedef signed long     FT_Int32;
   typedef unsigned long   FT_Word32;
@@ -137,11 +137,11 @@
 #error "no 32bit type found - please check your configuration files"
 #endif
 
-#if SIZEOF_LONG == 8
+#if FT_SIZEOF_LONG == 8
 
-  /* LONG64 must be defined when a 64-bit type is available */
-#define LONG64
-#define INT64   long
+  /* FT_LONG64 must be defined when a 64-bit type is available */
+#define FT_LONG64
+#define FT_INT64   long
 
 #else
 
@@ -156,8 +156,8 @@
   /*                                                                       */
 #ifdef FTCALC_USE_LONG_LONG
 
-#define LONG64
-#define INT64   long long
+#define FT_LONG64
+#define FT_INT64   long long
 
 #endif /* FTCALC_USE_LONG_LONG */
 #endif
diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h
index 82e1bf2..c8e320f 100644
--- a/include/freetype/internal/ftstream.h
+++ b/include/freetype/internal/ftstream.h
@@ -47,7 +47,8 @@ typedef enum FT_Frame_Op_
   ft_frame_off3_be   = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ),
   ft_frame_off3_le   = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ),
   
-  ft_frame_bytes     = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 )
+  ft_frame_bytes     = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ),
+  ft_frame_skip      = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 )
 
 } FT_Frame_Op;
 
@@ -96,6 +97,8 @@ typedef struct FT_Frame_Field_
             count,                                                \
             (FT_UShort)(char*)&FT_FIELD_REF(struct_type,field) }
 
+#define FT_FRAME_SKIP_BYTES( count ) { ft_frame_skip, count, 0 }
+            
 
 
   /*************************************************************************/
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 4d8bae6..55df20c 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -111,7 +111,7 @@
 #endif /* FT_CONFIG_OPTION_OLD_CALCS */
 
 
-#ifdef LONG64
+#ifdef FT_LONG64
 
   /*************************************************************************/
   /*                                                                       */
@@ -252,7 +252,7 @@
 
     while ( z )
     {
-      z = (unsigned INT64)z >> 1;
+      z = (unsigned FT_INT64)z >> 1;
       j++;
     }
     return j - 1;
@@ -298,7 +298,7 @@
 #endif /* FT_CONFIG_OPTION_OLD_CALCS */
 
 
-#else /* LONG64 */
+#else /* FT_LONG64 */
 
 
   /*************************************************************************/
@@ -767,7 +767,7 @@
 
 #endif /* FT_CONFIG_OPTION_OLD_CALCS */
 
-#endif /* LONG64 */
+#endif /* FT_LONG64 */
 
 
 /* END */
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index ddeda7d..3bbc73a 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -1084,7 +1084,7 @@
     FT_Pos     distance;
     int        c, n, first, orientation;
 
-    UNUSED( advance );
+    FT_UNUSED( advance );
 
 
     /* compute control distance */
diff --git a/src/base/ftstream.c b/src/base/ftstream.c
index 1ab657f..1d8b8b2 100644
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -540,20 +540,28 @@
         continue;  /* loop! */
 
       case ft_frame_bytes:  /* read a byte sequence */
+      case ft_frame_skip:   /* skip some bytes      */
         {
-          FT_Int  len = stream->limit - stream->cursor;
-
-
-          if ( len > fields->size )
-            len = fields->size;
-
-          p = (FT_Byte*)structure + fields->offset;
-          MEM_Copy( p, stream->cursor, len );
-          stream->cursor += len;
+          FT_Int  len = fields->size;
+          
+          if (stream->cursor + len > stream->limit)
+          {
+            error = FT_Err_Invalid_Stream_Operation;
+            goto Exit;
+          }
+          
+          if (fields->value == ft_frame_bytes)
+          {
+            p = (FT_Byte*)structure + fields->offset;
+            MEM_Copy( p, stream->cursor, len );
+          }
+          stream->cursor += len;  
           fields++;
           continue;
         }
 
+        
+
       case ft_frame_byte:
       case ft_frame_schar:  /* read a single byte */
         value = GET_Byte();
@@ -644,7 +652,7 @@
 
       /* now, compute the signed value is necessary */
       if ( fields->value & FT_FRAME_OP_SIGNED )
-        value = (FT_ULong)( (FT_Long)( value << sign_shift ) >> sign_shift );
+        value = (FT_ULong)( (FT_Int32)( value << sign_shift ) >> sign_shift );
 
       /* finally, store the value in the object */
 
@@ -659,23 +667,11 @@
         *(FT_UShort*)p = (FT_UShort)value;
         break;
 
-        /* SIZEOF_INT is defined in <freetype/config/ftconfig.h> */
-        /* and gives the size in bytes of the `int' type on the  */
-        /* current platform.                                     */
-        /*                                                       */
-        /* Only on 16-bit systems the value of SIZEOF_INT can be */
-        /* less than 4.  In this case SIZEOF_LONG is always 4.   */
-        /*                                                       */
-        /* On a 64-bit system, SIZEOF_LONG can be 8, which is    */
-        /* handled by the default case.                          */
-        /*                                                       */
-#if SIZEOF_INT == 4
       case 4:
-        *(FT_UInt*)p = (FT_UInt)value;
+        *(FT_UInt32*)p = (FT_UInt32)value;
         break;
-#endif
 
-      default:
+      default:  /* for 64-bits systems */
         *(FT_ULong*)p = (FT_ULong)value;
       }
 
diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c
index 1249402..1132152 100644
--- a/src/base/ftsystem.c
+++ b/src/base/ftsystem.c
@@ -70,7 +70,7 @@
   void*  ft_alloc( FT_Memory  memory,
                    long       size )
   {
-    UNUSED( memory );
+    FT_UNUSED( memory );
 
     return malloc( size );
   }
@@ -102,8 +102,8 @@
                      long       new_size,
                      void*      block )
   {
-    UNUSED( memory );
-    UNUSED( cur_size );
+    FT_UNUSED( memory );
+    FT_UNUSED( cur_size );
 
     return realloc( block, new_size );
   }
@@ -126,7 +126,7 @@
   void  ft_free( FT_Memory  memory,
                  void*      block )
   {
-    UNUSED( memory );
+    FT_UNUSED( memory );
 
     free( block );
   }
diff --git a/src/cff/t2gload.c b/src/cff/t2gload.c
index a0d5dc5..03bace5 100644
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -627,10 +627,10 @@
         {
           if ( ip + 3 >= limit )
             goto Syntax_Error;
-          val = ( (FT_Long)ip[0] << 24 ) |
-                ( (FT_Long)ip[1] << 16 ) |
-                ( (FT_Long)ip[2] <<  8 ) |
-                           ip[3];
+          val = ( (FT_Int32)ip[0] << 24 ) |
+                ( (FT_Int32)ip[1] << 16 ) |
+                ( (FT_Int32)ip[2] <<  8 ) |
+                            ip[3];
           ip    += 4;
           shift  = 0;
         }
diff --git a/src/cff/t2objs.c b/src/cff/t2objs.c
index 6eaea28..e274f8c 100644
--- a/src/cff/t2objs.c
+++ b/src/cff/t2objs.c
@@ -203,7 +203,7 @@
 
 #else
 
-    UNUSED( driver );
+    FT_UNUSED( driver );
 
     return T2_Err_Ok;
 
@@ -233,7 +233,7 @@
 
 #else
 
-    UNUSED( driver );
+    FT_UNUSED( driver );
 
 #endif
   }
diff --git a/src/cff/t2parse.c b/src/cff/t2parse.c
index 1af9795..9565765 100644
--- a/src/cff/t2parse.c
+++ b/src/cff/t2parse.c
@@ -519,16 +519,6 @@
             case t2_kind_fixed:
               val = t2_parse_fixed( parser->stack );
 
-              /* SIZEOF_INT is defined in <freetype/config/ftconfig.h> */
-              /* and gives the size in bytes of the `int' type on the  */
-              /* current platform.                                     */
-              /*                                                       */
-              /* Only on 16-bit systems the value of SIZEOF_INT can be */
-              /* less than 4.  In this case SIZEOF_LONG is always 4.   */
-              /*                                                       */
-              /* On a 64-bit system, SIZEOF_LONG can be 8, which is    */
-              /* handled by the default case.                          */
-              /*                                                       */
             Store_Number:
               switch ( field->size )
               {
@@ -540,13 +530,11 @@
                 *(FT_Short*)q = (FT_Short)val;
                 break;
 
-#if SIZEOF_INT == 4
               case 4:
-                *(FT_Int*)q = (FT_Int)val;
+                *(FT_Int32*)q = (FT_Int)val;
                 break;
-#endif
 
-              default:
+              default:  /* for 64-bit systems where long is 8 bytes */
                 *(FT_Long*)q = val;
               }
               break;
@@ -578,12 +566,12 @@
                   case 2:
                     *(FT_Short*)q = (FT_Short)val;
                     break;
-#if SIZEOF_INT == 4
+
                   case 4:
-                    *(FT_Int*)q = (FT_Int)val;
+                    *(FT_Int32*)q = (FT_Int)val;
                     break;
-#endif
-                  default:
+
+                  default:  /* for 64-bit systems */
                     *(FT_Long*)q = val;
                   }
 
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index c66496d..b9a94f5 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -466,7 +466,7 @@
   void t1_init_loader( CID_Loader*  loader,
                        CID_Face     face )
   {
-    UNUSED( face );
+    FT_UNUSED( face );
 
     MEM_Set( loader, 0, sizeof ( *loader ) );
   }
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 5b0af14..d0b241b 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -121,10 +121,10 @@
     FT_Error            error;
     PSNames_Interface*  psnames;
 
-    UNUSED( num_params );
-    UNUSED( params );
-    UNUSED( face_index );
-    UNUSED( stream );
+    FT_UNUSED( num_params );
+    FT_UNUSED( params );
+    FT_UNUSED( face_index );
+    FT_UNUSED( stream );
 
 
     face->root.num_faces = 1;
@@ -341,7 +341,7 @@
   LOCAL_FUNC
   FT_Error  CID_Init_Driver( CID_Driver  driver )
   {
-    UNUSED( driver );
+    FT_UNUSED( driver );
 
     return T1_Err_Ok;
   }
@@ -361,7 +361,7 @@
   LOCAL_DEF
   void  CID_Done_Driver( CID_Driver  driver )
   {
-    UNUSED( driver );
+    FT_UNUSED( driver );
   }
 
 
diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c
index 279d4b9..f272bde 100644
--- a/src/cid/cidparse.c
+++ b/src/cid/cidparse.c
@@ -761,13 +761,11 @@
             *(FT_UShort*)q = (FT_UShort)val;
             break;
 
-#if SIZEOF_INT == 4
           case 4:
-            *(FT_Int*)q = (FT_Int)val;
+            *(FT_Int32*)q = (FT_Int)val;
             break;
-#endif
 
-          default:
+          default:  /* for 64-bit systems */
             *(FT_Long*)q = val;
         }
         break;
diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c
index 4719554..651dcb1 100644
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -40,8 +40,8 @@
   FT_Module_Interface  CID_Get_Interface( FT_Driver         driver,
                                           const FT_String*  interface )
   {
-    UNUSED( driver );
-    UNUSED( interface );
+    FT_UNUSED( driver );
+    FT_UNUSED( interface );
 
     return 0;
   }
diff --git a/src/raster1/ftraster.c b/src/raster1/ftraster.c
index 19ca5aa..08acf39 100644
--- a/src/raster1/ftraster.c
+++ b/src/raster1/ftraster.c
@@ -146,7 +146,7 @@
   /* Its purpose is simply to reduce compiler warnings.  Note also that  */
   /* simply defining it as `(void)x' doesn't avoid warnings with certain */
   /* ANSI compilers (e.g. LCC).                                          */
-#define UNUSED( x )  (x) = (x)
+#define FT_UNUSED( x )  (x) = (x)
 
   /* Disable the tracing mechanism for simplicity -- developers can      */
   /* activate it easily by redefining these two macros.                  */
@@ -311,7 +311,7 @@
 #define RAS_VARS       /* void */
 #define RAS_VAR        /* void */
 
-#define UNUSED_RASTER  do ; while ( 0 )
+#define FT_UNUSED_RASTER  do ; while ( 0 )
 
 
 #else /* TT_STATIC_RASTER */
@@ -323,7 +323,7 @@
 #define RAS_VARS       raster,
 #define RAS_VAR        raster
 
-#define UNUSED_RASTER  UNUSED( raster )
+#define FT_UNUSED_RASTER  FT_UNUSED( raster )
 
 
 #endif /* TT_STATIC_RASTER */
@@ -2028,7 +2028,7 @@
   {
     Long  pitch = ras.target.pitch;
 
-    UNUSED( max );
+    FT_UNUSED( max );
 
 
     ras.traceIncr = (Short)-pitch;
@@ -2053,9 +2053,9 @@
     Byte   f1, f2;
     Byte*  target;
 
-    UNUSED( y );
-    UNUSED( left );
-    UNUSED( right );
+    FT_UNUSED( y );
+    FT_UNUSED( left );
+    FT_UNUSED( right );
 
 
     /* Drop-out control */
@@ -2239,9 +2239,9 @@
                                         Short*  max )
   {
     /* nothing, really */
-    UNUSED( raster );
-    UNUSED( min );
-    UNUSED( max );
+    FT_UNUSED( raster );
+    FT_UNUSED( min );
+    FT_UNUSED( max );
   }
 
 
@@ -2256,8 +2256,8 @@
     PByte  bits;
     Byte   f1;
 
-    UNUSED( left );
-    UNUSED( right );
+    FT_UNUSED( left );
+    FT_UNUSED( right );
 
 
     if ( x2 - x1 < ras.precision )
@@ -2388,7 +2388,7 @@
   void Horizontal_Sweep_Step( RAS_ARG )
   {
     /* Nothing, really */
-    UNUSED( raster );
+    FT_UNUSED( raster );
   }
 
 
@@ -2535,12 +2535,12 @@
                                              PProfile    right )
   {
     /* nothing, really */
-    UNUSED( raster );
-    UNUSED( y );
-    UNUSED( x1 );
-    UNUSED( x2 );
-    UNUSED( left );
-    UNUSED( right );
+    FT_UNUSED( raster );
+    FT_UNUSED( y );
+    FT_UNUSED( x1 );
+    FT_UNUSED( x2 );
+    FT_UNUSED( left );
+    FT_UNUSED( right );
   }
 
 
@@ -3097,7 +3097,7 @@
   LOCAL_FUNC
   FT_Error  Render_Gray_Glyph( RAS_ARG )
   {
-    UNUSED_RASTER;
+    FT_UNUSED_RASTER;
 
     return FT_Err_Cannot_Render_Glyph;
   }
@@ -3235,9 +3235,9 @@
 
 #else
 
-    UNUSED( raster );
-    UNUSED( mode );
-    UNUSED( palette );
+    FT_UNUSED( raster );
+    FT_UNUSED( mode );
+    FT_UNUSED( palette );
 
 #endif
   }
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index ccc67b5..fe0a271 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -77,7 +77,7 @@
   FT_Module_Interface  SFNT_Get_Interface( FT_Module    module,
                                            const char*  interface )
   {
-    UNUSED( module );
+    FT_UNUSED( module );
 
     if ( strcmp( interface, "get_sfnt" ) == 0 )
       return (FT_Module_Interface)get_sfnt_table;
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 8e4e448..cb3e0f0 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -186,8 +186,8 @@
     SFNT_Header         sfnt_header;
 
     /* for now, parameters are unused */
-    UNUSED( num_params );
-    UNUSED( params );
+    FT_UNUSED( num_params );
+    FT_UNUSED( params );
 
     sfnt = (SFNT_Interface*)face->sfnt;
     if ( !sfnt )
@@ -246,9 +246,9 @@
     FT_Error         error;
     SFNT_Interface*  sfnt = (SFNT_Interface*)face->sfnt;
 
-    UNUSED( face_index );
-    UNUSED( num_params );
-    UNUSED( params );
+    FT_UNUSED( face_index );
+    FT_UNUSED( num_params );
+    FT_UNUSED( params );
 
 
     /* Load tables */
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 61cc12f..7e3fab3 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -108,7 +108,7 @@
   /* Its purpose is simply to reduce compiler warnings.  Note also that  */
   /* simply defining it as `(void)x' doesn't avoid warnings with certain */
   /* ANSI compilers (e.g. LCC).                                          */
-#define UNUSED( x )  (x) = (x)
+#define FT_UNUSED( x )  (x) = (x)
 
   /* Disable the tracing mechanism for simplicity -- developers can      */
   /* activate it easily by redefining these two macros.                  */
@@ -125,7 +125,7 @@
 
 
 #include "ftgrays.h"
-#include <freetype/internal/ftobjs.h>  /* for UNUSED()                  */
+#include <freetype/internal/ftobjs.h>  /* for FT_UNUSED()                  */
 #include <freetype/internal/ftdebug.h> /* for FT_TRACE() and FT_ERROR() */
 #include <freetype/ftoutln.h>          /* for FT_Outline_Decompose()    */
 
@@ -1356,7 +1356,7 @@
     TScan  x, y, cover, area;
     PCell  start, cur, limit;
 
-    UNUSED( target );
+    FT_UNUSED( target );
 
 
     cur   = ras.cells;
@@ -1879,7 +1879,7 @@
   {
     static TRaster  the_raster;
 
-    UNUSED( memory );
+    FT_UNUSED( memory );
 
 
     *araster = (FT_Raster)&the_raster;
@@ -1893,7 +1893,7 @@
   void  grays_raster_done( FT_Raster  raster )
   {
     /* nothing */
-    UNUSED( raster );
+    FT_UNUSED( raster );
   }
 
 #else /* _STANDALONE_ */
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index d43220d..8921349 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -245,8 +245,8 @@
                              FT_UInt  pixel_width,
                              FT_UInt  pixel_height )
   {
-    UNUSED( pixel_width );
-    UNUSED( pixel_height );
+    FT_UNUSED( pixel_width );
+    FT_UNUSED( pixel_height );
 
     /* many things have been pre-computed by the base layer */
 
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index df6c1ef..ad7c726 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -813,7 +813,7 @@
     {
       TT_GlyphSlot  glyph = (TT_GlyphSlot)loader->glyph;
       FT_UInt       start_point, start_contour;
-      
+      FT_ULong      ins_pos;  /* position of composite instructions, if any */
 
       /* for each subglyph, read composite header */
       start_point   = gloader->base.outline.n_points;
@@ -823,6 +823,7 @@
       if ( error )
         goto Fail;
 
+      ins_pos = loader->ins_pos;
       face->forget_glyph_frame( loader );
       opened_frame = 0;
 
@@ -973,7 +974,7 @@
 
         if ( num_subglyphs > 0               &&
              loader->exec                    &&
-             loader->ins_pos > 0             &&
+             ins_pos         > 0             &&
              subglyph->flags & WE_HAVE_INSTR )
         {
           FT_UShort       n_ins;
@@ -984,8 +985,8 @@
 
 
           /* read size of instructions */
-          if ( FILE_Seek( loader->ins_pos ) ||
-               READ_UShort( n_ins )         )
+          if ( FILE_Seek( ins_pos ) ||
+               READ_UShort( n_ins ) )
             goto Fail;
           FT_TRACE5(( "  Instructions size = %d\n", n_ins ));
 
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index b890b64..d6fd2ed 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -31,7 +31,7 @@
 #define TT_MULFIX   FT_MulFix
 #define TT_MULDIV   FT_MulDiv
 
-#define TT_INT64    FT_Int64
+#define TT_FT_INT64    FT_Int64
 
 
   /*************************************************************************/
@@ -122,7 +122,7 @@
   /* This macro is used whenever `exec' is unused in a function, to avoid  */
   /* stupid warnings from pedantic compilers.                              */
   /*                                                                       */
-#define UNUSED_EXEC  UNUSED( CUR )
+#define FT_UNUSED_EXEC  FT_UNUSED( CUR )
 
 
   /*************************************************************************/
@@ -130,7 +130,7 @@
   /* This macro is used whenever `args' is unused in a function, to avoid  */
   /* stupid warnings from pedantic compilers.                              */
   /*                                                                       */
-#define UNUSED_ARG  UNUSED_EXEC; UNUSED( args )
+#define FT_UNUSED_ARG  FT_UNUSED_EXEC; FT_UNUSED( args )
 
 
   /*************************************************************************/
@@ -731,7 +731,7 @@
     exec->callTop = 0;
 
 #if 1
-    UNUSED( debug );
+    FT_UNUSED( debug );
 
     return exec->face->interpreter( exec );
 #else
@@ -839,7 +839,7 @@
   FT_Error  TT_Done_Context( TT_ExecContext  exec )
   {
     /* Nothing at all for now */
-    UNUSED( exec );
+    FT_UNUSED( exec );
 
     return TT_Err_Ok;
   }
@@ -850,7 +850,7 @@
   static FT_F26Dot6  Norm( FT_F26Dot6  X,
                            FT_F26Dot6  Y )
   {
-    TT_INT64  T1, T2;
+    TT_FT_INT64  T1, T2;
 
 
     MUL_64( X, X, T1 );
@@ -1479,7 +1479,7 @@
                                 FT_UShort      point,
                                 FT_F26Dot6     distance )
   {
-    UNUSED_EXEC;
+    FT_UNUSED_EXEC;
 
     zone->cur[point].x += distance;
     zone->tags[point]  |= FT_Curve_Tag_Touch_X;
@@ -1491,7 +1491,7 @@
                                 FT_UShort      point,
                                 FT_F26Dot6     distance )
   {
-    UNUSED_EXEC;
+    FT_UNUSED_EXEC;
 
     zone->cur[point].y += distance;
     zone->tags[point]  |= FT_Curve_Tag_Touch_Y;
@@ -1526,7 +1526,7 @@
   {
     FT_F26Dot6  val;
 
-    UNUSED_EXEC;
+    FT_UNUSED_EXEC;
 
 
     if ( distance >= 0 )
@@ -1566,7 +1566,7 @@
   {
     FT_F26Dot6  val;
 
-    UNUSED_EXEC;
+    FT_UNUSED_EXEC;
 
 
     if ( distance >= 0 )
@@ -1610,7 +1610,7 @@
   {
     FT_F26Dot6  val;
 
-    UNUSED_EXEC;
+    FT_UNUSED_EXEC;
 
 
     if ( distance >= 0 )
@@ -1652,7 +1652,7 @@
   {
     FT_F26Dot6  val;
 
-    UNUSED_EXEC;
+    FT_UNUSED_EXEC;
 
 
     if ( distance >= 0 )
@@ -1697,7 +1697,7 @@
     FT_F26Dot6  val;
 
 
-    UNUSED_EXEC;
+    FT_UNUSED_EXEC;
 
     if ( distance >= 0 )
     {
@@ -1740,7 +1740,7 @@
   {
     FT_F26Dot6 val;
 
-    UNUSED_EXEC;
+    FT_UNUSED_EXEC;
 
 
     if ( distance >= 0 )
@@ -2073,7 +2073,7 @@
   FT_F26Dot6  Project_x( EXEC_OP_ FT_Vector*  v1,
                                   FT_Vector*  v2 )
   {
-    UNUSED_EXEC;
+    FT_UNUSED_EXEC;
 
     return ( v1->x - v2->x );
   }
@@ -2099,7 +2099,7 @@
   FT_F26Dot6  Project_y( EXEC_OP_ FT_Vector*  v1,
                                   FT_Vector*  v2 )
   {
-    UNUSED_EXEC;
+    FT_UNUSED_EXEC;
 
    return ( v1->y - v2->y );
   }
@@ -2214,7 +2214,7 @@
     FT_F26Dot6  W;
     FT_Bool     S1, S2;
 
-    UNUSED_EXEC;
+    FT_UNUSED_EXEC;
 
 
     if ( ABS( Vx ) < 0x10000L && ABS( Vy ) < 0x10000L )
@@ -3986,7 +3986,7 @@
   {
     FT_Long  A, B, C;
 
-    UNUSED_EXEC;
+    FT_UNUSED_EXEC;
 
 
     A = args[2];
@@ -4089,7 +4089,7 @@
   {
     FT_Int  nIfs;
 
-    UNUSED_ARG;
+    FT_UNUSED_ARG;
 
 
     nIfs = 1;
@@ -4198,7 +4198,7 @@
   {
     TT_CallRec*  pRec;
 
-    UNUSED_ARG;
+    FT_UNUSED_ARG;
 
 
     if ( CUR.callTop <= 0 )     /* We encountered an ENDF without a call */
@@ -5010,7 +5010,7 @@
   {
     FT_UShort  point;
 
-    UNUSED_ARG;
+    FT_UNUSED_ARG;
 
 
     if ( CUR.top < CUR.GS.loop )
@@ -5192,7 +5192,7 @@
                   dy;
     FT_UShort     point;
 
-    UNUSED_ARG;
+    FT_UNUSED_ARG;
 
 
     if ( CUR.top < CUR.GS.loop )
@@ -5757,7 +5757,7 @@
     FT_UShort   point;
     FT_F26Dot6  distance;
 
-    UNUSED_ARG;
+    FT_UNUSED_ARG;
 
 
     if ( CUR.top < CUR.GS.loop ||
@@ -5926,7 +5926,7 @@
                 distance;
     FT_UShort   point;
 
-    UNUSED_ARG;
+    FT_UNUSED_ARG;
 
 
     if ( CUR.top < CUR.GS.loop )
@@ -6165,7 +6165,7 @@
     FT_UInt   point;         /* current point   */
     FT_Short  contour;       /* current contour */
 
-    UNUSED_ARG;
+    FT_UNUSED_ARG;
 
 
     if ( CUR.opcode & 1 )
@@ -6433,7 +6433,7 @@
     TT_DefRecord*  def   = CUR.IDefs;
     TT_DefRecord*  limit = def + CUR.numIDefs;
 
-    UNUSED_ARG;
+    FT_UNUSED_ARG;
 
 
     for ( ; def < limit; def++ )
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 76ab375..5dc9949 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -128,10 +128,10 @@
                             FT_UInt     horz_resolution,
                             FT_UInt     vert_resolution )
   {
-    UNUSED( char_width );
-    UNUSED( char_height );
-    UNUSED( horz_resolution );
-    UNUSED( vert_resolution );
+    FT_UNUSED( char_width );
+    FT_UNUSED( char_height );
+    FT_UNUSED( horz_resolution );
+    FT_UNUSED( vert_resolution );
 
     size->valid = FALSE;
 
@@ -164,8 +164,8 @@
                              FT_Int   pixel_width,
                              FT_Int   pixel_height )
   {
-    UNUSED( pixel_width );
-    UNUSED( pixel_height );
+    FT_UNUSED( pixel_width );
+    FT_UNUSED( pixel_height );
 
     size->valid = FALSE;
 
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index 82f454b..2a5bd6a 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -408,9 +408,9 @@
     FT_Vector*   flex  = decoder->flex_vectors;
     FT_Int       n;
 
-    UNUSED( threshold );
-    UNUSED( end_x );
-    UNUSED( end_y );
+    FT_UNUSED( threshold );
+    FT_UNUSED( end_x );
+    FT_UNUSED( end_y );
 
 
     /* we don't even try to test the threshold in the non-hinting   */
@@ -1080,9 +1080,9 @@
                         FT_Pos       wx,
                         FT_Pos       wy )
   {
-    UNUSED( sbx );
-    UNUSED( sby );
-    UNUSED( wy );
+    FT_UNUSED( sbx );
+    FT_UNUSED( sby );
+    FT_UNUSED( wy );
 
     if ( wx > decoder->builder.advance.x )
       decoder->builder.advance.x = wx;
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index aed196b..d646c8a 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -592,7 +592,7 @@
   static
   FT_Error  Do_Def_Ignore( T1_Parser*  parser )
   {
-    UNUSED( parser );
+    FT_UNUSED( parser );
     return T1_Err_Ok;
   }
 
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 5b14d4b..fe866ac 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -103,7 +103,7 @@
     return error;
 #else
 
-    UNUSED( error );
+    FT_UNUSED( error );
 
     return T1_Err_Ok;
 
@@ -262,10 +262,10 @@
     FT_Error            error;
     PSNames_Interface*  psnames;
 
-    UNUSED( num_params );
-    UNUSED( params );
-    UNUSED( face_index );
-    UNUSED( face );
+    FT_UNUSED( num_params );
+    FT_UNUSED( params );
+    FT_UNUSED( face_index );
+    FT_UNUSED( face );
 
 
     face->root.num_faces = 1;
@@ -486,7 +486,7 @@
 
 #else
 
-    UNUSED( glyph );
+    FT_UNUSED( glyph );
 
 #endif
   }
@@ -515,7 +515,7 @@
 
 #else
 
-    UNUSED( glyph );
+    FT_UNUSED( glyph );
 
 #endif
 
diff --git a/src/type1z/z1driver.c b/src/type1z/z1driver.c
index a262f27..286d9bd 100644
--- a/src/type1z/z1driver.c
+++ b/src/type1z/z1driver.c
@@ -58,8 +58,8 @@
   FT_Module_Interface  Get_Interface( FT_Driver         driver,
                                       const FT_String*  interface )
   {
-    UNUSED(driver);
-    UNUSED(interface);
+    FT_UNUSED(driver);
+    FT_UNUSED(interface);
     
 #ifndef Z1_CONFIG_OPTION_NO_MM_SUPPORT
     if ( strcmp( (const char*)interface, "get_mm" ) == 0 )
diff --git a/src/type1z/z1load.c b/src/type1z/z1load.c
index 3083b5f..11e8893 100644
--- a/src/type1z/z1load.c
+++ b/src/type1z/z1load.c
@@ -573,7 +573,7 @@
  {
    Z1_Parser*  parser = &loader->parser;
    
-   UNUSED(face);
+   FT_UNUSED(face);
    
    parser->cursor = parser->limit;
    parser->error  = 0;
@@ -1334,7 +1334,7 @@
   static
   void t1_init_loader( Z1_Loader* loader, T1_Face  face )
   {
-    UNUSED(face);
+    FT_UNUSED(face);
 
     MEM_Set( loader, 0, sizeof(*loader) );
     loader->num_glyphs = 0;
diff --git a/src/type1z/z1objs.c b/src/type1z/z1objs.c
index 27e022c..5acaadb 100644
--- a/src/type1z/z1objs.c
+++ b/src/type1z/z1objs.c
@@ -132,10 +132,10 @@
     FT_Error      error;
     PSNames_Interface*  psnames;
 
-    UNUSED(num_params);
-    UNUSED(params);
-    UNUSED(face_index);
-    UNUSED(stream);
+    FT_UNUSED(num_params);
+    FT_UNUSED(params);
+    FT_UNUSED(face_index);
+    FT_UNUSED(stream);
 
     face->root.num_faces = 1;
 
@@ -333,7 +333,7 @@
   LOCAL_FUNC
   FT_Error  Z1_Init_Driver( Z1_Driver  driver )
   {
-    UNUSED(driver);
+    FT_UNUSED(driver);
     return T1_Err_Ok;
   }
 
@@ -354,7 +354,7 @@
   LOCAL_DEF
   void  Z1_Done_Driver( Z1_Driver  driver )
   {
-    UNUSED(driver);
+    FT_UNUSED(driver);
   }
 
 
diff --git a/src/type1z/z1parse.c b/src/type1z/z1parse.c
index 55c013f..ed24458 100644
--- a/src/type1z/z1parse.c
+++ b/src/type1z/z1parse.c
@@ -771,12 +771,12 @@
             case 2:
               *(FT_UShort*)q = (FT_UShort)val;
               break;
-#if SIZEOF_INT == 4
+
             case 4:
-              *(FT_Int*)q = (FT_Int)val;
+              *(FT_UInt32*)q = (FT_UInt32)val;
               break;
-#endif
-            default:
+
+            default:  /* for 64-bit systems */
               *(FT_Long*)q = val;
             }
           }