Commit cc9fc49c907c7d4c3c41a845cfaba7eaf85418c3

Werner Lemberg 2000-06-30T06:21:26

Formatting... Applying some fixes from Tom.

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
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 1df4ec7..e64236d 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -682,6 +682,8 @@
     if ( slot->flags & ft_glyph_own_bitmap )
     {
       FT_Memory  memory = FT_FACE_MEMORY( slot->face );
+
+
       FREE( slot->bitmap.buffer );
       slot->flags &= ~ft_glyph_own_bitmap;
     }
@@ -958,31 +960,32 @@
     if ( load_flags & FT_LOAD_NO_RECURSE )
       load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
 
-    /* do we need to load the glyph through the auto-hinter ?? */
+    /* do we need to load the glyph through the auto-hinter? */
     library  = driver->root.library;
     hinter   = library->auto_hinter;
     autohint = hinter &&
-               !(load_flags & (FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING));
-    if (autohint)
+               !( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) );
+    if ( autohint )
     {
       if ( FT_DRIVER_HAS_HINTER( driver ) &&
-           !(load_flags & FT_LOAD_FORCE_AUTOHINT) )
-	autohint = 0;
-    }	       
+           !( load_flags & FT_LOAD_FORCE_AUTOHINT ) )
+        autohint = 0;
+    }
     
-    if (autohint)
+    if ( autohint )
     {
       FT_AutoHinter_Interface*  hinting;
       
+
       hinting = (FT_AutoHinter_Interface*)hinter->clazz->module_interface;
-      error = hinting->load_glyph( (FT_AutoHinter)hinter, slot,  face->size,
+      error = hinting->load_glyph( (FT_AutoHinter)hinter, slot, face->size,
                                    glyph_index, load_flags );
     }
     else
       error = driver->clazz->load_glyph( slot,
                                          face->size,
-					 glyph_index,
-					 load_flags );
+                                         glyph_index,
+                                         load_flags );
     if ( error )
       goto Exit;
 
@@ -1013,15 +1016,17 @@
       FT_Vector_Transform( &slot->advance, &face->transform_matrix );
     }
 
-    /* do we need to render the image now ? */
+    /* do we need to render the image now? */
     if ( !error                                    &&
          slot->format != ft_glyph_format_bitmap    &&
          slot->format != ft_glyph_format_composite &&
-	 load_flags & FT_LOAD_RENDER )
+         load_flags & FT_LOAD_RENDER )
     {
-      error = FT_Render_Glyph( slot, (load_flags & FT_LOAD_ANTI_ALIAS) ?
-                                ft_render_mode_antialias : 0 );
-    }	 
+      error = FT_Render_Glyph( slot,
+                               ( load_flags & FT_LOAD_ANTI_ALIAS )
+                                  ? ft_render_mode_antialias
+                                  : 0 );
+    } 
 
   Exit:
     return error;
@@ -2773,8 +2778,8 @@
         goto Fail;
     }
 
-    /* is the module a auto-hinter ? */
-    if ( FT_MODULE_IS_HINTER(module) )
+    /* is the module a auto-hinter? */
+    if ( FT_MODULE_IS_HINTER( module ) )
       library->auto_hinter = module;
       
     /* if the module is a font driver */
diff --git a/src/cff/t2driver.c b/src/cff/t2driver.c
index 9864058..5f81b2b 100644
--- a/src/cff/t2driver.c
+++ b/src/cff/t2driver.c
@@ -144,7 +144,6 @@
 #undef PAIR_TAG
 
 
-
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -203,6 +202,7 @@
 
     /* force drop-out mode to 2 - irrelevant now */
     /* slot->outline.dropout_mode = 2; */
+
     return error;
   }
 
diff --git a/src/cff/t2gload.c b/src/cff/t2gload.c
index ee4f254..47f9794 100644
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -413,7 +413,7 @@
   }
 
 
-  /* check room for a new on-curve point, then add it */
+  /* check space for a new on-curve point, then add it */
   static
   FT_Error  add_point1( T2_Builder*  builder,
                         FT_Pos       x,
@@ -485,17 +485,17 @@
   {
     FT_Outline*  outline = builder->current;
 
-    /* XXXX : we must not include the last point in the path if it */
-    /*        is located on the first point..                      */
-    if (outline->n_points > 1)
+    /* XXXX: We must not include the last point in the path if it */
+    /*       is located on the first point.                       */
+    if ( outline->n_points > 1 )
     {
       FT_Int      first = 0;
       FT_Vector*  p1    = outline->points + first;
-      FT_Vector*  p2    = outline->points + outline->n_points-1;
+      FT_Vector*  p2    = outline->points + outline->n_points - 1;
       
-      if (outline->n_contours > 1)
+      if ( outline->n_contours > 1 )
       {
-        first = outline->contours[outline->n_contours-2]+1;
+        first = outline->contours[outline->n_contours - 2] + 1;
         p1    = outline->points + first;
       }
         
@@ -508,9 +508,12 @@
   }
 
 
-#define USE_ARGS( n )  top -= n;                   \
-                       if ( top < decoder->stack ) \
-                         goto Stack_Underflow
+#define USE_ARGS( n )  do                            \
+                       {                             \
+                         top -= n;                   \
+                         if ( top < decoder->stack ) \
+                           goto Stack_Underflow;     \
+                       } while ( 0 )
 
 
   /*************************************************************************/
@@ -522,12 +525,12 @@
   /*    Parses a given Type 2 charstrings program.                         */
   /*                                                                       */
   /* <InOut>                                                               */
-  /*    decoder          :: The current Type 1 decoder.                    */
+  /*    decoder         :: The current Type 1 decoder.                     */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    charstring_base  :: The base of the charstring stream.             */
+  /*    charstring_base :: The base of the charstring stream.              */
   /*                                                                       */
-  /*    charstring_len   :: The length in bytes of the charstring stream.  */
+  /*    charstring_len  :: The length in bytes of the charstring stream.   */
   /*                                                                       */
   /* <Return>                                                              */
   /*    FreeType error code.  0 means success.                             */
@@ -537,15 +540,15 @@
                                   FT_Byte*     charstring_base,
                                   FT_Int       charstring_len )
   {
-    FT_Error            error;
-    T2_Decoder_Zone*    zone;
-    FT_Byte*            ip;
-    FT_Byte*            limit;
-    T2_Builder*         builder = &decoder->builder;
-    FT_Outline*         outline;
-    FT_Pos              x, y;
-    FT_Fixed            seed;
-    FT_Fixed*           stack;
+    FT_Error          error;
+    T2_Decoder_Zone*  zone;
+    FT_Byte*          ip;
+    FT_Byte*          limit;
+    T2_Builder*       builder = &decoder->builder;
+    FT_Outline*       outline;
+    FT_Pos            x, y;
+    FT_Fixed          seed;
+    FT_Fixed*         stack;
 
 
     /* set default width */
@@ -611,7 +614,7 @@
         {
           if ( ip >= limit )
             goto Syntax_Error;
-          val = (v - 247) * 256 + *ip++ + 108;
+          val = ( v - 247 ) * 256 + *ip++ + 108;
         }
         else if ( v < 255 )
         {
@@ -625,7 +628,8 @@
             goto Syntax_Error;
           val = ( (FT_Long)ip[0] << 24 ) |
                 ( (FT_Long)ip[1] << 16 ) |
-                ( (FT_Long)ip[2] <<  8 ) | ip[3];
+                ( (FT_Long)ip[2] <<  8 ) |
+                           ip[3];
           ip    += 4;
           shift  = 0;
         }
@@ -652,6 +656,7 @@
 
         /* find operator */
         op = t2_op_unknown;
+
         switch ( v )
         {
         case 1:
@@ -852,8 +857,8 @@
         case t2_op_vstem:
         case t2_op_hstemhm:
         case t2_op_vstemhm:
-          /* if the number of arguments is no even, the first one  */
-          /* is simply the glyph width.. encoded as the difference */
+          /* if the number of arguments is not even, the first one */
+          /* is simply the glyph width, encoded as the difference  */
           /* to nominalWidthX                                      */
           FT_TRACE4(( op == t2_op_hstem   ? " hstem"   :
                       op == t2_op_vstem   ? " vstem"   :
@@ -865,8 +870,8 @@
 
         case t2_op_hintmask:
         case t2_op_cntrmask:
-          FT_TRACE4(( op == t2_op_hintmask ? " hintmask" :
-                                             " cntrmask" ));
+          FT_TRACE4(( op == t2_op_hintmask ? " hintmask"
+                                           : " cntrmask" ));
 
           decoder->num_hints += num_args / 2;
           ip += ( decoder->num_hints + 7 ) >> 3;
@@ -930,8 +935,8 @@
             FT_Int  phase = ( op == t2_op_hlineto );
 
 
-            FT_TRACE4(( op == t2_op_hlineto ? " hlineto" :
-                                              " vlineto" ));
+            FT_TRACE4(( op == t2_op_hlineto ? " hlineto"
+                                            : " vlineto" ));
 
             if ( start_point ( builder, x, y )     ||
                  check_points( builder, num_args ) )
@@ -958,7 +963,7 @@
         case t2_op_rrcurveto:
           FT_TRACE4(( " rrcurveto" ));
 
-          /* check number of arguments, must be a multiple of 6 */
+          /* check number of arguments; must be a multiple of 6 */
           if ( num_args % 6 != 0 )
             goto Stack_Underflow;
 
@@ -1057,8 +1062,8 @@
             FT_Int  phase;
 
 
-            FT_TRACE4(( op == t2_op_vhcurveto ? " vhcurveto" :
-                                                " hvcurveto" ));
+            FT_TRACE4(( op == t2_op_vhcurveto ? " vhcurveto"
+                                              : " hvcurveto" ));
 
             if ( start_point ( builder, x, y ) )
               goto Memory_Error;
@@ -1071,6 +1076,7 @@
               goto Stack_Underflow;
 
             phase = ( op == t2_op_hvcurveto );
+
             while ( num_args >= 4 )
             {
               num_args -= 4;
@@ -1286,6 +1292,7 @@
         case t2_op_drop:
           /* nothing */
           FT_TRACE4(( " drop" ));
+
           break;
 
         case t2_op_exch:
@@ -1349,7 +1356,7 @@
             }
             else
             {
-              while (index < 0)
+              while ( index < 0 )
               {
                 FT_Fixed  tmp = args[0];
                 FT_Int    i;
@@ -1379,6 +1386,7 @@
 
 
             FT_TRACE4(( " put" ));
+
             if ( index >= 0 && index < decoder->len_buildchar )
               decoder->buildchar[index] = val;
           }
@@ -1406,7 +1414,7 @@
           goto Unimplemented;
 
         case t2_op_load:
-           FT_TRACE4(( " load" ));
+          FT_TRACE4(( " load" ));
 
           goto Unimplemented;
 
@@ -1469,7 +1477,8 @@
 
             if ( index >= decoder->num_locals )
             {
-              FT_ERROR(( "T2_Parse_Charstrings: invalid local subr index\n" ));
+              FT_ERROR(( "T2_Parse_CharStrings:" ));
+              FT_ERROR(( "  invalid local subr index\n" ));
               goto Syntax_Error;
             }
 
@@ -1482,9 +1491,9 @@
             zone->cursor = ip;  /* save current instruction pointer */
 
             zone++;
-            zone->base    = decoder->locals[index];
-            zone->limit   = decoder->locals[index+1];
-            zone->cursor  = zone->base;
+            zone->base   = decoder->locals[index];
+            zone->limit  = decoder->locals[index+1];
+            zone->cursor = zone->base;
 
             if ( !zone->base )
             {
@@ -1508,7 +1517,8 @@
 
             if ( index >= decoder->num_globals )
             {
-              FT_ERROR(( "T2_Parse_Charstrings: invalid global subr index\n" ));
+              FT_ERROR(( "T2_Parse_CharStrings:" ));
+              FT_ERROR(( " invalid global subr index\n" ));
               goto Syntax_Error;
             }
 
@@ -1559,6 +1569,7 @@
           if ( ip[-1] == 12 )
             FT_ERROR(( " %d", ip[0] ));
           FT_ERROR(( "\n" ));
+
           return T2_Err_Unimplemented_Feature;
         }
 
@@ -1693,9 +1704,9 @@
     if ( load_flags & FT_LOAD_NO_RECURSE )
       load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
 
-    glyph->x_scale = 0x10000;
-    glyph->y_scale = 0x10000;
-    if (size)
+    glyph->x_scale = 0x10000L;
+    glyph->y_scale = 0x10000L;
+    if ( size )
     {
       glyph->x_scale = size->metrics.x_scale;
       glyph->y_scale = size->metrics.y_scale;
@@ -1717,7 +1728,7 @@
       T2_Init_Decoder( &decoder, face, size, glyph );
 
       decoder.builder.no_recurse =
-        (FT_Bool)( (load_flags & FT_LOAD_NO_RECURSE) != 0 );
+        (FT_Bool)( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 );
 
       /* now load the unscaled outline */
       error = T2_Access_Element( &cff->charstrings_index, glyph_index,
@@ -1734,13 +1745,13 @@
       T2_Done_Builder( &decoder.builder );
     }
 
-    /* Now, set the metrics - this is rather simple, as    */
+    /* Now, set the metrics -- this is rather simple, as   */
     /* the left side bearing is the xMin, and the top side */
     /* bearing the yMax.                                   */
     if ( !error )
     {
-      /* for composite glyphs, return only the left side bearing and the */
-      /* advance width..                                                 */
+      /* for composite glyphs, return only left side bearing and */
+      /* advance width                                           */
       if ( glyph->root.format == ft_glyph_format_composite )
       {
         glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;
@@ -1748,12 +1759,12 @@
       }
       else
       {
-        FT_BBox           cbox;
-        FT_Glyph_Metrics* metrics = &glyph->root.metrics;
+        FT_BBox            cbox;
+        FT_Glyph_Metrics*  metrics = &glyph->root.metrics;
 
 
         /* copy the _unscaled_ advance width */
-        metrics->horiAdvance  = decoder.glyph_width;
+        metrics->horiAdvance = decoder.glyph_width;
 
         /* make up vertical metrics */
         metrics->vertBearingX = 0;
@@ -1795,8 +1806,8 @@
           metrics->vertAdvance  = FT_MulFix( metrics->vertAdvance,  x_scale );
         }
 
-        /* apply the font matrix */
 #if 0
+        /* apply the font matrix */
         FT_Outline_Transform( &glyph->root.outline, cff->font_matrix );
 #endif
 
@@ -1808,8 +1819,8 @@
         {
           cbox.xMin &= -64;
           cbox.yMin &= -64;
-          cbox.xMax = ( cbox.xMax + 63 ) & -64;
-          cbox.yMax = ( cbox.yMax + 63 ) & -64;
+          cbox.xMax  = ( cbox.xMax + 63 ) & -64;
+          cbox.yMax  = ( cbox.yMax + 63 ) & -64;
         }
 
         metrics->width  = cbox.xMax - cbox.xMin;
diff --git a/src/cff/t2gload.h b/src/cff/t2gload.h
index 5117f34..39ef98c 100644
--- a/src/cff/t2gload.h
+++ b/src/cff/t2gload.h
@@ -177,9 +177,8 @@
   FT_Error  T2_Compute_Max_Advance( TT_Face  face,
                                     FT_Int*  max_advance );
 
-#endif
+#endif /* 0 */
 
-  /* This function is exported, because it is used by the T1Dump utility */
   LOCAL_DEF
   FT_Error  T2_Parse_CharStrings( T2_Decoder*  decoder,
                                   FT_Byte*     charstring_base,
diff --git a/src/cff/t2load.c b/src/cff/t2load.c
index 7040489..2981c8c 100644
--- a/src/cff/t2load.c
+++ b/src/cff/t2load.c
@@ -46,7 +46,10 @@
 
 
     for ( result = 0; off_size > 0; off_size-- )
-      result = ( result <<= 8 ) | *p++;
+    {
+      result <<= 8;
+      result  |= *p++;
+    }
 
     return result;
   }
@@ -66,7 +69,7 @@
 
     index->stream = stream;
     if ( !READ_UShort( count ) &&
-          count > 0            )
+         count > 0             )
     {
       FT_Byte*   p;
       FT_Byte    offsize;
@@ -74,7 +77,7 @@
       FT_ULong*  poff;
 
 
-      /* there is at least one element; read the offset size            */
+      /* there is at least one element; read the offset size,           */
       /* then access the offset table to compute the index's total size */
       if ( READ_Byte( offsize ) )
         goto Exit;
@@ -196,8 +199,8 @@
         {
           element++;
           off2 = index->offsets[element];
-        }
-        while ( off2 == 0 && element < index->count );
+
+        } while ( off2 == 0 && element < index->count );
 
         if ( !off2 )
           off1 = 0;
@@ -362,26 +365,22 @@
     switch ( format )
     {
     case 0:     /* format 0, that's simple */
-      {
-        select->data_size = num_glyphs;
-        goto Load_Data;
-      }
+      select->data_size = num_glyphs;
+      goto Load_Data;
 
     case 3:     /* format 3, a tad more complex */
-      {
-        if ( READ_UShort( num_ranges ) )
-          goto Exit;
+      if ( READ_UShort( num_ranges ) )
+        goto Exit;
 
-        select->data_size = num_ranges * 3 + 2;
+      select->data_size = num_ranges * 3 + 2;
 
-      Load_Data:
-        if ( EXTRACT_Frame( select->data_size, select->data ) )
-          goto Exit;
-      }
+    Load_Data:
+      if ( EXTRACT_Frame( select->data_size, select->data ) )
+        goto Exit;
       break;
 
 
-    default:    /* humm... that's wrong */
+    default:    /* hmm... that's wrong */
       error = FT_Err_Invalid_File_Format;
     }
 
@@ -439,6 +438,7 @@
             break;
           }
           first = limit;
+
         } while ( p < p_limit );
       }
       break;
@@ -495,7 +495,7 @@
     if ( error )
       goto Exit;
 
-    /* if it's a CID font, we stop there */
+    /* if it is a CID font, we stop there */
     if ( top->cid_registry )
       goto Exit;
 
diff --git a/src/cff/t2objs.c b/src/cff/t2objs.c
index 2de766c..6eaea28 100644
--- a/src/cff/t2objs.c
+++ b/src/cff/t2objs.c
@@ -80,6 +80,7 @@
     FT_Error         error;
     SFNT_Interface*  sfnt;
 
+
     sfnt = (SFNT_Interface*)FT_Get_Module_Interface(
              face->root.driver->root.library, "sfnt" );
     if ( !sfnt )
@@ -94,7 +95,7 @@
     if ( error )
       goto Exit;
 
-    if ( face->format_tag != 0x4f54544fL )     /* OpenType/CFF font */
+    if ( face->format_tag != 0x4F54544FL )  /* `OTTO'; OpenType/CFF font */
     {
       FT_TRACE2(( "[not a valid OpenType/CFF font]\n" ));
       goto Bad_Format;
@@ -109,7 +110,7 @@
     if ( error )
       goto Exit;
 
-    /* now, load the CFF part of the file.. */
+    /* now, load the CFF part of the file */
     error = face->goto_table( face, TTAG_CFF, stream, 0 );
     if ( error )
       goto Exit;
@@ -129,7 +130,7 @@
         goto Exit;
 
       /* Complement the root flags with some interesting information. */
-      /* note that for OpenType/CFF, there is no need to do this, but */
+      /* Note that for OpenType/CFF, there is no need to do this, but */
       /* this will be necessary for pure CFF fonts through.           */
       root = &face->root;
     }
@@ -157,9 +158,9 @@
   LOCAL_DEF
   void  T2_Done_Face( T2_Face  face )
   {
-    FT_Memory  memory = face->root.memory;
+    FT_Memory        memory = face->root.memory;
+    SFNT_Interface*  sfnt   = face->sfnt;
 
-    SFNT_Interface*  sfnt = face->sfnt;
 
     if ( sfnt )
       sfnt->done_face( face );
@@ -195,11 +196,17 @@
   FT_Error  T2_Init_Driver( T2_Driver  driver )
   {
     /* init extension registry if needed */
+
 #ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+
     return TT_Init_Extensions( driver );
+
 #else
+
     UNUSED( driver );
+
     return T2_Err_Ok;
+
 #endif
   }
 
@@ -219,10 +226,15 @@
   void  T2_Done_Driver( T2_Driver  driver )
   {
     /* destroy extensions registry if needed */
+
 #ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+
     TT_Done_Extensions( driver );
+
 #else
+
     UNUSED( driver );
+
 #endif
   }
 
diff --git a/src/cff/t2objs.h b/src/cff/t2objs.h
index 2e30b4e..cc37d23 100644
--- a/src/cff/t2objs.h
+++ b/src/cff/t2objs.h
@@ -95,9 +95,9 @@
   /*                                                                     */
   typedef struct  T2_DriverRec_
   {
-    FT_DriverRec    root;
+    FT_DriverRec  root;
 
-    void*           extension_component;
+    void*         extension_component;
 
   } T2_DriverRec;
 
diff --git a/src/cff/t2parse.c b/src/cff/t2parse.c
index 1d4fc5a..53f15e0 100644
--- a/src/cff/t2parse.c
+++ b/src/cff/t2parse.c
@@ -102,7 +102,8 @@
 
       val = ( (FT_Long)p[0] << 24 ) |
             ( (FT_Long)p[1] << 16 ) |
-            ( (FT_Long)p[2] <<  8 ) | p[3];
+            ( (FT_Long)p[2] <<  8 ) |
+                       p[3];
       p += 4;
     }
     else if ( v < 247 )
@@ -135,7 +136,7 @@
   }
 
 
-  /* reads a real */
+  /* read a real */
   static
   FT_Fixed  parse_t2_real( FT_Byte*  start,
                            FT_Byte*  limit,
@@ -258,7 +259,7 @@
   }
 
 
-  /* reads a number, either integer or real */
+  /* read a number, either integer or real */
   static
   FT_Long  t2_parse_num( FT_Byte**  d )
   {
@@ -293,7 +294,7 @@
       matrix->yx = t2_parse_fixed( data++ );
       matrix->xy = t2_parse_fixed( data++ );
       matrix->yy = t2_parse_fixed( data   );
-      error = 0;
+      error = T2_Err_Ok;
     }
 
     return error;
@@ -303,9 +304,9 @@
   static
   FT_Error  parse_font_bbox( T2_Parser*  parser )
   {
-    CFF_Font_Dict*  dict   = (CFF_Font_Dict*)parser->object;
-    FT_BBox*        bbox   = &dict->font_bbox;
-    FT_Byte**       data   = parser->stack;
+    CFF_Font_Dict*  dict = (CFF_Font_Dict*)parser->object;
+    FT_BBox*        bbox = &dict->font_bbox;
+    FT_Byte**       data = parser->stack;
     FT_Error        error;
 
 
@@ -317,7 +318,7 @@
       bbox->yMin = t2_parse_num( data++ );
       bbox->xMax = t2_parse_num( data++ );
       bbox->yMax = t2_parse_num( data   );
-      error = 0;
+      error = T2_Err_Ok;
     }
 
     return error;
@@ -338,7 +339,7 @@
     {
       dict->private_size   = t2_parse_num( data++ );
       dict->private_offset = t2_parse_num( data   );
-      error = 0;
+      error = T2_Err_Ok;
     }
 
     return error;
@@ -360,7 +361,7 @@
       dict->cid_registry   = (FT_UInt)t2_parse_num( data++ );
       dict->cid_ordering   = (FT_UInt)t2_parse_num( data++ );
       dict->cid_supplement = (FT_ULong)t2_parse_num( data );
-      error = 0;
+      error = T2_Err_Ok;
     }
 
     return error;
@@ -386,7 +387,8 @@
             code | T2CODE,              \
             0, 0,                       \
             parse_ ## name,             \
-            0, 0 },
+            0, 0                        \
+          },
 
 #undef  T2_FIELD
 #define T2_FIELD( code, name, kind )                 \
@@ -426,7 +428,7 @@
                            FT_Byte*    limit )
   {
     FT_Byte*  p     = start;
-    FT_Error  error = 0;
+    FT_Error  error = T2_Err_Ok;
 
 
     parser->top    = parser->stack;
@@ -474,7 +476,7 @@
       }
       else
       {
-        /* this is not a number, hence it's an operator.  Compute its code */
+        /* This is not a number, hence it's an operator.  Compute its code */
         /* and look for it in our current list.                            */
 
         FT_UInt                  code;
@@ -551,11 +553,11 @@
 
             case t2_kind_delta:
               {
-                FT_Byte*  qcount = (FT_Byte*)parser->object +
-                                     field->count_offset;
+                FT_Byte*   qcount = (FT_Byte*)parser->object +
+                                      field->count_offset;
 
-                FT_Long   val;
-                FT_Byte** data = parser->stack;
+                FT_Long    val;
+                FT_Byte**  data = parser->stack;
 
 
                 if ( num_args > field->array_max )
@@ -576,6 +578,12 @@
                   case 2:
                     *(FT_Short*)q = (FT_Short)val;
                     break;
+#if SIZEOF_INT == 4
+                  case 4:
+                    *(FT_Int*)q = (FT_Int)val;
+                    break;
+#endif
+
                   default:
                     *(FT_Long*)q = val;
                   }
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index 756fb87..9945082 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -335,17 +335,18 @@
   {
     FT_Outline*  outline = builder->current;
 
-    /* XXXX : we must not include the last point in the path if it */
-    /*        is located on the first point..                      */
-    if (outline->n_points > 1)
+    /* XXXX: We must not include the last point in the path if it */
+    /*       is located on the first point.                       */
+    if ( outline->n_points > 1 )
     {
       FT_Int      first = 0;
       FT_Vector*  p1    = outline->points + first;
-      FT_Vector*  p2    = outline->points + outline->n_points-1;
+      FT_Vector*  p2    = outline->points + outline->n_points - 1;
       
-      if (outline->n_contours > 1)
+
+      if ( outline->n_contours > 1 )
       {
-        first = outline->contours[outline->n_contours-2]+1;
+        first = outline->contours[outline->n_contours - 2] + 1;
         p1    = outline->points + first;
       }
         
@@ -1121,7 +1122,10 @@
           FT_TRACE4(( " div" ));
 
           if ( top[1] )
-            *top++ = top[0] / top[1];
+          {
+            *top = top[0] / top[1];
+            top++;
+          }
           else
           {
             FT_ERROR(( "CID_Parse_CharStrings: division by 0\n" ));
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 5087f12..b1da224 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -276,7 +276,7 @@
     if ( LOAD_( hdmx )          ||
          LOAD_( gasp )          ||
          LOAD_( kerning )       ||
-	 LOAD_( pclt )          )
+         LOAD_( pclt )          )
       goto Exit;
 
 #ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index f0e6782..d27e8f2 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -1236,17 +1236,18 @@
   {
     FT_Outline*  cur = builder->current;
 
-    /* XXXX : we must not include the last point in the path if it */
-    /*        is located on the first point..                      */
-    if (cur->n_points > 1)
+    /* XXXX: We must not include the last point in the path if it */
+    /*       is located on the first point.                       */
+    if ( cur->n_points > 1 )
     {
       FT_Int      first = 0;
       FT_Vector*  p1    = cur->points + first;
-      FT_Vector*  p2    = cur->points + cur->n_points-1;
+      FT_Vector*  p2    = cur->points + cur->n_points - 1;
       
-      if (cur->n_contours > 1)
+
+      if ( cur->n_contours > 1 )
       {
-        first = cur->contours[cur->n_contours-2]+1;
+        first = cur->contours[cur->n_contours - 2] + 1;
         p1    = cur->points + first;
       }
         
@@ -1259,7 +1260,7 @@
       cur->contours[cur->n_contours - 1] = cur->n_points - 1;
 
 #ifndef T1_CONFIG_OPTION_DISABLE_HINTER
-    /* hint latest points if needed - this is not strictly required      */
+    /* hint latest points if needed -- this is not strictly required     */
     /* there, but it helps for debugging, and doesn't affect performance */
     if ( builder->pass == 1 )
       T1_Hint_Points( builder );