Commit ddbb8e7b6a554bc56a9c5eae88d006fedbc0fa25

Werner Lemberg 2000-10-26T10:04:16

Some formatting. Fixed some data types/added header files to remove compiler warnings. Added trivial input data check to FT_Outline_Get_BBox(). Fixed type1z -> type1 file inclusions.

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
diff --git a/include/freetype/ftbbox.h b/include/freetype/ftbbox.h
index 54a05b9..ffdd423 100644
--- a/include/freetype/ftbbox.h
+++ b/include/freetype/ftbbox.h
@@ -56,10 +56,10 @@
   /*    bbox    :: The outline's exact bounding box.                       */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
-  FT_EXPORT_DEF(FT_Error)  FT_Outline_Get_BBox( FT_Outline*  outline,
-                                                FT_BBox     *abbox );
+  FT_EXPORT_DEF( FT_Error )  FT_Outline_Get_BBox( FT_Outline*  outline,
+                                                  FT_BBox*     bbox );
 
 
 #ifdef __cplusplus
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
index 2440203..6dc50f5 100644
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1399,7 +1399,7 @@
     FT_Bool            vertical_info;
     TT_VertHeader      vertical;     /* TT Vertical header, if present */
 
-    FT_Int             num_names;    /* number of name records  */
+    FT_UShort          num_names;    /* number of name records  */
     TT_NameTable       name_table;   /* name table              */
 
     TT_OS2             os2;          /* TrueType OS/2 table            */
@@ -1437,7 +1437,7 @@
     TT_Gasp            gasp;                 /* the `gasp' table */
 
     /* PCL 5 table */
-	TT_PCLT            pclt;
+    TT_PCLT            pclt;
 
     /* embedded bitmaps support */
     FT_Int             num_sbit_strikes;
diff --git a/src/base/ftbbox.c b/src/base/ftbbox.c
index 484ea4a..f53432a 100644
--- a/src/base/ftbbox.c
+++ b/src/base/ftbbox.c
@@ -15,14 +15,12 @@
 /*                                                                         */
 /***************************************************************************/
 
+
   /*************************************************************************/
   /*                                                                       */
   /* This component has a _single_ role: to compute exact outline bounding */
   /* boxes.                                                                */
   /*                                                                       */
-  /* It is separated from the rest of the engine for various technical     */
-  /* reasons.  It may well be integrated in `ftoutln' later.               */
-  /*                                                                       */
   /*************************************************************************/
 
 
@@ -30,6 +28,7 @@
 #include <freetype/ftimage.h>
 #include <freetype/ftoutln.h>
 
+
   typedef struct  TBBox_Rec_
   {
     FT_Vector  last;
@@ -45,8 +44,8 @@
   /*                                                                       */
   /* <Description>                                                         */
   /*    This function is used as a `move_to' and `line_to' emitter during  */
-  /*    FT_Outline_Decompose.  It simply records the destination point in  */
-  /*    `user->last'.                                                      */
+  /*    FT_Outline_Decompose().  It simply records the destination point   */
+  /*    in `user->last'.                                                   */
   /*                                                                       */
   /* <Input>                                                               */
   /*    to   :: A pointer to the destination vector.                       */
@@ -55,7 +54,7 @@
   /*    user :: A pointer to the current walk context.                     */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    Always 0.  Needed for the interface only.                          */
   /*                                                                       */
   static
   int  BBox_Move_To( FT_Vector*  to,
@@ -151,7 +150,7 @@
   /*    user    :: The address of the current walk context.                */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    Always 0.  Needed for the interface only.                          */
   /*                                                                       */
   /* <Note>                                                                */
   /*    In the case of a non-monotonous arc, we compute directly the       */
@@ -273,7 +272,7 @@
 
     Suite:
       ;
-    } while (arc >= stack);
+    } while ( arc >= stack );
   }
 
 
@@ -297,7 +296,7 @@
   /*    user     :: The address of the current walk context.               */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    Always 0.  Needed for the interface only.                          */
   /*                                                                       */
   /* <Note>                                                                */
   /*    In the case of a non-monotonous arc, we don't compute directly     */
@@ -354,21 +353,24 @@
   /*    abbox   :: A pointer to the outline's exact bounding box.          */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    Error code.  0 means success.                                      */
+  /*    FreeType error code.  0 means success.                             */
   /*                                                                       */
   FT_EXPORT_FUNC( FT_Error )  FT_Outline_Get_BBox( FT_Outline*  outline,
                                                    FT_BBox*     abbox )
   {
-    FT_BBox    cbox;
-    FT_BBox    bbox;
-    FT_Vector* vec;
-    FT_UShort  n;
+    FT_BBox     cbox;
+    FT_BBox     bbox;
+    FT_Vector*  vec;
+    FT_UShort   n;
 
 
-    /* if outline is empty, return (0,0,0,0) */
+    if ( !abbox )
+      return FT_Err_Invalid_Argument;
+
     if ( !outline )
       return FT_Err_Invalid_Outline;
 
+    /* if outline is empty, return (0,0,0,0) */
     if ( outline->n_points == 0 || outline->n_contours <= 0 )
     {
       abbox->xMin = abbox->xMax = 0;
diff --git a/src/base/rules.mk b/src/base/rules.mk
index af62ec2..7698c41 100644
--- a/src/base/rules.mk
+++ b/src/base/rules.mk
@@ -48,7 +48,7 @@ BASE_SRC := $(BASE_)ftcalc.c   \
 #
 BASE_EXT_SRC := $(BASE_)ftglyph.c \
                 $(BASE_)ftmm.c    \
-		$(BASE_)ftbbox.c
+                $(BASE_)ftbbox.c
 
 # Default extensions objects
 #
diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c
index 19d33b8..9f7f52c 100644
--- a/src/cache/ftcimage.c
+++ b/src/cache/ftcimage.c
@@ -24,6 +24,8 @@
 
 #include <string.h>
 
+#include <freetype/internal/ftmemory.h>
+
 
   /*************************************************************************/
   /*************************************************************************/
diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c
index efe4165..c425960 100644
--- a/src/psaux/psauxmod.c
+++ b/src/psaux/psauxmod.c
@@ -68,7 +68,7 @@
   };
 
 
-  LOCAL_FUNC
+  static
   const PSAux_Interface  psaux_interface =
   {
     &ps_table_funcs,
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index 7bd5349..8fac327 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -269,7 +269,8 @@
   }
 
 
-  static const PSNames_Interface  psnames_interface =
+  static
+  const PSNames_Interface  psnames_interface =
   {
 #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
 
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index 48c07c0..c9b8e7e 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -169,7 +169,7 @@
     FT_Error   error;
 
     FT_Int     num_glyphs;
-    FT_Int     num_names;
+    FT_UShort  num_names;
 
     FT_UShort* glyph_indices = 0;
     FT_Char**  name_strings  = 0;
@@ -229,7 +229,7 @@
 
     /* now load the name strings */
     {
-      FT_Int  n;
+      FT_UShort  n;
 
 
       if ( ALLOC_ARRAY( name_strings, num_names, FT_Char* ) )
@@ -264,7 +264,7 @@
 
   Fail1:
     {
-      FT_Int  n;
+      FT_UShort  n;
 
 
       for ( n = 0; n < num_names; n++ )
@@ -401,7 +401,7 @@
       case 0x00020000L:
         {
           TT_Post_20*  table = &names->names.format_20;
-          FT_UInt      n;
+          FT_UShort    n;
 
 
           FREE( table->glyph_indices );
diff --git a/src/type1/type1.c b/src/type1/type1.c
index 17e89ac..07d9145 100644
--- a/src/type1/type1.c
+++ b/src/type1/type1.c
@@ -1,6 +1,6 @@
 /***************************************************************************/
 /*                                                                         */
-/*  type1z.c                                                               */
+/*  type1.c                                                                */
 /*                                                                         */
 /*    FreeType experimental Type 1 driver component (body only).           */
 /*                                                                         */
@@ -33,14 +33,14 @@
 
 #else /* FT_FLAT_COMPILE */
 
-#include <type1z/z1parse.c>
-#include <type1z/z1load.c>
-#include <type1z/z1objs.c>
-#include <type1z/z1driver.c>
-#include <type1z/z1gload.c>
+#include <type1/z1parse.c>
+#include <type1/z1load.c>
+#include <type1/z1objs.c>
+#include <type1/z1driver.c>
+#include <type1/z1gload.c>
 
 #ifndef Z1_CONFIG_OPTION_NO_AFM
-#include <type1z/z1afm.c>
+#include <type1/z1afm.c>
 #endif
 
 #endif /* FT_FLAT_COMPILE */
diff --git a/src/type1/z1afm.c b/src/type1/z1afm.c
index e47349c..f7d0282 100644
--- a/src/type1/z1afm.c
+++ b/src/type1/z1afm.c
@@ -22,7 +22,7 @@
 
 #else
 
-#include <type1z/z1afm.h>
+#include <type1/z1afm.h>
 
 #endif
 
diff --git a/src/type1/z1afm.h b/src/type1/z1afm.h
index bfacce7..5e25e7e 100644
--- a/src/type1/z1afm.h
+++ b/src/type1/z1afm.h
@@ -26,7 +26,7 @@
 
 #else
 
-#include <type1z/z1objs.h>
+#include <type1/z1objs.h>
 
 #endif
 
diff --git a/src/type1/z1driver.c b/src/type1/z1driver.c
index 11990d8..c3aacb3 100644
--- a/src/type1/z1driver.c
+++ b/src/type1/z1driver.c
@@ -25,10 +25,10 @@
 
 #else
 
-#include <type1z/z1driver.h>
-#include <type1z/z1gload.h>
-#include <type1z/z1load.h>
-#include <type1z/z1afm.h>
+#include <type1/z1driver.h>
+#include <type1/z1gload.h>
+#include <type1/z1load.h>
+#include <type1/z1afm.h>
 
 #endif
 
diff --git a/src/type1/z1gload.c b/src/type1/z1gload.c
index d9a552c..57e44a0 100644
--- a/src/type1/z1gload.c
+++ b/src/type1/z1gload.c
@@ -22,7 +22,7 @@
 
 #else
 
-#include <type1z/z1gload.h>
+#include <type1/z1gload.h>
 
 #endif
 
diff --git a/src/type1/z1gload.h b/src/type1/z1gload.h
index c9a913b..da4560a 100644
--- a/src/type1/z1gload.h
+++ b/src/type1/z1gload.h
@@ -26,7 +26,7 @@
 
 #else
 
-#include <type1z/z1objs.h>
+#include <type1/z1objs.h>
 
 #endif
 
diff --git a/src/type1/z1load.c b/src/type1/z1load.c
index 37fb99e..b367115 100644
--- a/src/type1/z1load.c
+++ b/src/type1/z1load.c
@@ -75,7 +75,7 @@
 
 #else
 
-#include <type1z/z1load.h>
+#include <type1/z1load.h>
 
 #endif
 
@@ -1388,7 +1388,7 @@
 
 #else
 
-#include <type1z/z1tokens.h>
+#include <type1/z1tokens.h>
 
 #endif
 
diff --git a/src/type1/z1load.h b/src/type1/z1load.h
index ca94f8a..0a20d93 100644
--- a/src/type1/z1load.h
+++ b/src/type1/z1load.h
@@ -30,7 +30,7 @@
 
 #else
 
-#include <type1z/z1parse.h>
+#include <type1/z1parse.h>
 
 #endif
 
diff --git a/src/type1/z1objs.c b/src/type1/z1objs.c
index 8772692..6ec21b3 100644
--- a/src/type1/z1objs.c
+++ b/src/type1/z1objs.c
@@ -28,9 +28,9 @@
 
 #else
 
-#include <type1z/z1gload.h>
-#include <type1z/z1load.h>
-#include <type1z/z1afm.h>
+#include <type1/z1gload.h>
+#include <type1/z1load.h>
+#include <type1/z1afm.h>
 
 #endif
 
diff --git a/src/type1/z1parse.c b/src/type1/z1parse.c
index 07e7a15..64e0f84 100644
--- a/src/type1/z1parse.c
+++ b/src/type1/z1parse.c
@@ -46,7 +46,7 @@
 
 #else
 
-#include <type1z/z1parse.h>
+#include <type1/z1parse.h>
 
 #endif